Comments (3)
I can not reproduce the error.
Please show the code to reproduce.
or
grunt --verbose option log
e.g. grunt typescript --verbose
from grunt-typescript.
I've just found this error too. The TypeScript compiler is writing all source files out multiple times (so for 100 input files it will write out 100 * 100 = 10,000 files).
Here is an example project showing the problem: https://github.com/Coridyn/grunt-typescript-debug
Expected output:
--host.writeFile: src/app.js
write file: src/app.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/app.js
--host.writeFile: src/other-file.js
write file: src/other-file.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/other-file.js
2 files created. js: 2 files, map: 0 files, declaration: 0 files
Actual output:
--host.writeFile: src/app.js
write file: src/app.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/app.js
--host.writeFile: src/other-file.js
write file: src/other-file.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/other-file.js
--host.writeFile: src/app.js
write file: src/app.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/app.js
--host.writeFile: src/other-file.js
write file: src/other-file.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/other-file.js
--host.writeFile: src/app.js
write file: src/app.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/app.js
--host.writeFile: src/other-file.js
write file: src/other-file.js => l:/User/projects/WidgetWorks/wiwo-playground/grunt-typescript-debug/dist/other-file.js
6 files created. js: 6 files, map: 0 files, declaration: 0 files (492ms)
It looks like typescript.js compile()
function (https://github.com/k-maru/grunt-typescript/blob/master/tasks/typescript.js#L738) calls checker.emitFiles()
for every file.
program.getSourceFiles().forEach(function (sourceFile) {
if (!options.noLib && sourceFile.filename === defaultLibFilename) {
return;
}
var emitOutput = checker.emitFiles(sourceFile);
errors.push.apply(errors, emitOutput.errors);
});
and tsc.js emitFiles()
(https://github.com/Microsoft/TypeScript/blob/v1.1.0.1/bin/tsc.js#L8496) calls emitFile()
for every file as well
ts.forEach(program.getSourceFiles(), function (sourceFile) {
if (shouldEmitToOwnFile(sourceFile)) {
var jsFilePath = getOwnEmitOutputFilePath(sourceFile, ".js");
emitFile(jsFilePath, sourceFile);
}
});
from grunt-typescript.
Thanks Coridyn.
It seems that my reading was not enough.
I has released a modified version 0.4.3
from grunt-typescript.
Related Issues (20)
- 0.6.1 -> 0.6.2 is not a "patch" revision HOT 1
- Does not detect file changes on vagrant synced_folder HOT 1
- Typescript 1.5 options missing HOT 1
- Upgrade "typescript" package dependency from 1.5.0-beta to 1.5.3 HOT 6
- Allow compilation of System.JS and UMD modules HOT 2
- Add option to use custom TypeScript compiler version HOT 2
- Single destination file is empty HOT 2
- Transpile only files which have changed HOT 2
- Map files
- JSX compilerOption not supported
- es6 doesn't compile classes HOT 5
- Question HOT 1
- Customize typescript compiler version? HOT 1
- Warning: path.replace is not a function Used HOT 1
- Wrong default target
- Update TypeScript Dep. to 1.8.2 HOT 6
- grunt-typescript VS gtunt-ts: why maintaining two plugins that do the same? HOT 6
- Empty js file when compiling ts to single js file
- BasePath option has been deprecated HOT 1
- Running typescript task with version 6.2 gives me "duplicate identifier" errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-typescript.