You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ts-loader's default config makes Webpack extremely slow in larger projects #91
Hey @ludvon The second method I get: when I try and run npm run test
[at-loader] Using typescript@2.4.2 from typescript and "tsconfig.json" from /Users/neil/Projects/cardihabApp/tsconfig.json.
TypeError: Cannot read property 'watchRun' of undefined
Hey @ludvon the first option I got working, it has better reporting on how long it took to compile, doesn't make it run faster though:
I do like the install was easy npm install --save-dev fork-ts-checker-webpack-plugin
output Starting type checking service...
Using 1 worker with 2048MB memory limit
Type checking in progress...
webpack: Compiled successfully.
webpack: Compiling...
No type errors found
Version: typescript 2.4.2
Time: 140845ms
04 06 2018 15:52:27.402:WARN [karma]: No captured browser, open http://localhost:9876/
After installing awesome-typescript-loader@3.5.0 the first time I call npm run test all work as expected but if I make a change into an spec.ts file Karma crashes with this message:
ℹ 「wdm」: Compiling...
06 10 2018 14:56:24.105:ERROR [karma]: TypeError: Cannot read property '_tsInstances' of undefined
at resolveInstance (C:\Users\User\Documents\myProject\node_modules\awesome-typescript-loader\src\instance.ts:73:20)
at C:\Users\User\Documents\myProject\node_modules\awesome-typescript-loader\src\instance.ts:366:26
at _err1 (eval at create (C:\Users\User\Documents\myProject\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:17:1)
at invalid (C:\Users\User\Documents\myProject\node_modules\webpack-dev-middleware\lib\context.js:76:7)
at context.compiler.plugin (C:\Users\User\Documents\myProject\node_modules\webpack-dev-middleware\lib\context.js:116:5)
at _err0 (eval at create (C:\Users\User\Documents\myProject\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:12:1)
at C:\Users\User\Documents\myProject\node_modules\karma-webpack\lib\karma-webpack.js:124:9 at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\User\Documents\myProject\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:7:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\User\Documents\myProject\node_modules\tapable\lib\Hook.js:154:20)
at Watching._go (C:\Users\User\Documents\myProject\node_modules\webpack\lib\Watching.js:40:32)
at Watching._invalidate (C:\Users\User\Documents\myProject\node_modules\webpack\lib\Watching.js:165:9)
at watcher.compiler.watchFileSystem.watch (C:\Users\User\Documents\myProject\node_modules\webpack\lib\Watching.js:136:10)
at Watchpack.watcher.once (C:\Users\User\Documents\myProject\node_modules\webpack\lib\node\NodeWatchFileSystem.js:54:4)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at Watchpack.emit (events.js:214:7)
The problem is that awesome-typescript-loader@3.5.0 can not work with Webpack 4.x, so I downgraded Webpack to 3.10 and it works.
I can not say if it is faster because I am right now in my crappy old laptop.
Edit: A quick Warning.
Using awesome-typescript-loader will break the detail page of your coverage tests.
Updated Webpack to 4.23.1 and used the option 2. Got the following error:
✖ 「atl」: Child process failed to process the request: TypeError: Cannot read property 'Created' of undefined
at onFileCreated (node_modules/awesome-typescript-loader/src/checker/runtime.ts:256:61)
at updateFile (node_modules/awesome-typescript-loader/src/checker/runtime.ts:391:4)
at processEmit (node_modules/awesome-typescript-loader/src/checker/runtime.ts:457:3)
at node_modules/awesome-typescript-loader/src/checker/runtime.ts:610:6
at Object.send (node_modules/awesome-typescript-loader/src/checker/runtime.ts:49:6)
at Checker.req (node_modules/awesome-typescript-loader/src/checker/checker.ts:100:15)
at Checker.emitFile (node_modules/awesome-typescript-loader/src/checker/checker.ts:105:15)
at transform (node_modules/awesome-typescript-loader/src/index.ts:130:26)
at transformationFunction (node_modules/awesome-typescript-loader/src/index.ts:72:40)
at compiler (node_modules/awesome-typescript-loader/src/index.ts:83:21)
at Object.loader (node_modules/awesome-typescript-loader/src/index.ts:14:12)
at LOADER_EXECUTION (node_modules/loader-runner/lib/LoaderRunner.js:119:14)
at runSyncOrAsync (node_modules/loader-runner/lib/LoaderRunner.js:120:4)
at iterateNormalLoaders (node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at iterateNormalLoaders (node_modules/loader-runner/lib/LoaderRunner.js:218:10)
Update: Upgrading typescript to 3.1.3 fixed it but the compilation is still slow. Here are my current dependencies:
Activity
neilbo commentedon Jun 4, 2018
Hey @ludvon The second method I get: when I try and run
npm run testneilbo commentedon Jun 4, 2018
Hey @ludvon the first option I got working, it has better reporting on how long it took to compile, doesn't make it run faster though:
npm install --save-dev fork-ts-checker-webpack-pluginvilanz commentedon Jun 5, 2018
@neilbo About the second method, it seems that
awesome-typescript-loader@3.5.0is the correct version fortypescript@2.4.2neilbo commentedon Jun 8, 2018
@ludvon you are a legend!
I ended up doing
npm i awesome-typescript-loader@3.5.0 --saved-devIt went from 14-15sec to compile to 1-2sec! I've got ~ 450 unit tests
Cheers!
distante commentedon Oct 6, 2018
Just to add that 3.5.0 is the correct version for typescript 2.x.x . I was not sure about this and maybe other person has the same doubt.
(4.0.0 works with typescript > 2.7 )
distante commentedon Oct 6, 2018
After installing
awesome-typescript-loader@3.5.0the first time I callnpm run testall work as expected but if I make a change into anspec.tsfile Karma crashes with this message:The problem is that
awesome-typescript-loader@3.5.0can not work with Webpack 4.x, so I downgraded Webpack to 3.10 and it works.I can not say if it is faster because I am right now in my crappy old laptop.
Edit: A quick Warning.
Using awesome-typescript-loader will break the detail page of your coverage tests.
v1bh0r commentedon Oct 29, 2018
Updated Webpack to 4.23.1 and used the option 2. Got the following error:
✖ 「atl」: Child process failed to process the request: TypeError: Cannot read property 'Created' of undefined
at onFileCreated (node_modules/awesome-typescript-loader/src/checker/runtime.ts:256:61)
at updateFile (node_modules/awesome-typescript-loader/src/checker/runtime.ts:391:4)
at processEmit (node_modules/awesome-typescript-loader/src/checker/runtime.ts:457:3)
at node_modules/awesome-typescript-loader/src/checker/runtime.ts:610:6
at Object.send (node_modules/awesome-typescript-loader/src/checker/runtime.ts:49:6)
at Checker.req (node_modules/awesome-typescript-loader/src/checker/checker.ts:100:15)
at Checker.emitFile (node_modules/awesome-typescript-loader/src/checker/checker.ts:105:15)
at transform (node_modules/awesome-typescript-loader/src/index.ts:130:26)
at transformationFunction (node_modules/awesome-typescript-loader/src/index.ts:72:40)
at compiler (node_modules/awesome-typescript-loader/src/index.ts:83:21)
at Object.loader (node_modules/awesome-typescript-loader/src/index.ts:14:12)
at LOADER_EXECUTION (node_modules/loader-runner/lib/LoaderRunner.js:119:14)
at runSyncOrAsync (node_modules/loader-runner/lib/LoaderRunner.js:120:4)
at iterateNormalLoaders (node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at iterateNormalLoaders (node_modules/loader-runner/lib/LoaderRunner.js:218:10)
Update: Upgrading typescript to 3.1.3 fixed it but the compilation is still slow. Here are my current dependencies:
Update 2: Followed @distante 's suggestions and method 2 fixed the performance issue
Here are my current dependencies: