s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

Crash on file update in webpack 4 #554

Closed estaub closed 6 years ago

estaub commented 6 years ago

This is in a context where webpack is processing an array of two configs, so two loaders are running concurrently. When a source file is modified, a-t-l crashes immediately.

I can't spend the time right now to narrow it down to a simple example; maybe just the stack trace will be enough for a light bulb to appear. Let me know if I can help resolve any theories.

webpack 4.1.1 awesome-typescript-loader 4.0.1

/Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/node_modules/awesome-typescript-loader/src/instance.ts:73
    if (!compiler._tsInstances) {
               ^
TypeError: Cannot read property '_tsInstances' of undefined
    at resolveInstance (/Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/node_modules/awesome-typescript-loader/src/instance.ts:73:16)
    at /Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/node_modules/awesome-typescript-loader/src/instance.ts:368:20
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:25:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/node_modules/webpack/node_modules/tapable/lib/Hook.js:35:21)
    at Watching._go (/Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/node_modules/webpack/lib/Watching.js:40:32)

I see nothing strange in the original compile:

[at-loader] Using typescript@2.7.2 from typescript and "tsconfig.json" from /Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/tsconfig.ssr.json.

[at-loader] Using typescript@2.7.2 from typescript and "tsconfig.json" from /Users/edstaub/git/yeanay/yeanay-mono/packages/yeanay-client/tsconfig.json.

[at-loader] Checking started in a separate process...
[at-loader] Ok, 2.468 sec.

[at-loader] Checking started in a separate process...
[at-loader] Ok, 3.065 sec.

webpack built f12565b2a6283ec6ca1a in 60857ms
s-panferov commented 6 years ago

atl 4.x does not work with webpack4, please use 5.x versions

samdenty commented 6 years ago

@s-panferov Is it intentional that version 5.0.0-1 is not yet in @latest / @prerelease or @next ?

image https://www.npmjs.com/package/awesome-typescript-loader?activeTab=versions