s-panferov / awesome-typescript-loader

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

webpack 4 support #534

Open sanex3339 opened 6 years ago

sanex3339 commented 6 years ago

Webpack 4 in beta now, so can you update plugin to support it?

Delagen commented 6 years ago

Please update enhanced-resolve dependency binding

sanex3339 commented 6 years ago

Any news?

s-panferov commented 6 years ago

I hope to find some time next weekend.

DovydasNavickas commented 6 years ago

Hey, maybe you need some help? I've started building an updated configuration for all of our projects with webpack 4 and I've encountered some errors right away with awesome-typescript-loader on watch.

As I'm more than familiar with working on build tools and with typescript's compiler API, I think I could help 🙂

s-panferov commented 6 years ago

@DovydasNavickas I would glad if you make some investigation about what we need to do to properly migrate. I know that ts-loader already has some webpack4 support, so maybe we can use results of their's investigation.

DovydasNavickas commented 6 years ago

Snap... ts-loader has a PR with quite a few changes. https://github.com/TypeStrong/ts-loader/pull/710/files

DovydasNavickas commented 6 years ago

I guess a good starting point is this article: https://medium.com/webpack/webpack-4-migration-guide-for-plugins-loaders-20a79b927202

DovydasNavickas commented 6 years ago

Ok, so it's an easy fix for a changed Webpack's API instead of compiler.plugin to use compiler.hooks.

So, to not get Webpack's errors we have to update function setupWatchRun in instance.ts line 367:

function setupWatchRun(compiler, instanceName: string) {
-   compiler.plugin('watch-run', function(watching, callback) {
-       const instance = resolveInstance(watching.compiler, instanceName)
+   compiler.hooks.watchRun.tapAsync(PACKAGE_NAME, (compiler, callback) => {
+       const instance = resolveInstance(compiler, instanceName)
        const checker = instance.checker
        const watcher =
-           watching.compiler.watchFileSystem.watcher ||
-           watching.compiler.watchFileSystem.wfs.watcher
+           compiler.watchFileSystem.watcher ||
+           compiler.watchFileSystem.wfs.watcher

-       const startTime = instance.startTime || watching.startTime
+       const startTime = instance.startTime

But then it starts spitting out errors (58 errors in my case, to be exact) in Typescript's typechecking, such as:

ERROR in [at-loader] TS2688: Cannot find type definition file for 'node'.

ERROR in [at-loader] TS2318: Cannot find global type 'Array'.

ERROR in [at-loader] TS2318: Cannot find global type 'Boolean'.

ERROR in [at-loader] TS2318: Cannot find global type 'Function'.

ERROR in [at-loader] TS2318: Cannot find global type 'IArguments'.

ERROR in [at-loader] TS2318: Cannot find global type 'Number'.

ERROR in [at-loader] TS2318: Cannot find global type 'Object'.

ERROR in [at-loader] TS2318: Cannot find global type 'RegExp'.

ERROR in [at-loader] TS2318: Cannot find global type 'String'.

Soo.... It clearly has some problems with compiler configuration before it starts compiling after watch change and I'm not really sure where to start looking. Maybe you could take a look? I'll spend a bit more time, if you see nothing and don't come up with a quick fix 🙂

By the way, exactly same kind of upgrade has to be done for setupAfterCompile function in line 444. Just not sure what to do with lines 462 and 464 as the parameter coming into tapAsync function is compiler instead of compiler coming as compilation.compiler before.

In short, I'll have to spend a bit more time to get a good sense about how the library works, because I did not manage to come up with a proper debugging strategy apart from npm link the package into a test project using Webpack and console.log interesting bits. If you have ideas how to have a proper debugging session, I'm happy to hear 😄

DovydasNavickas commented 6 years ago

P.S. now that I think of it, why the hell didn't I go with using tests right away?... I guess sometimes you just don't think on Sundays 😂

niemyjski commented 6 years ago

So I noticed that I get the following error when the following web pack plugin is enabled TsConfigPathsPlugin. I'm using web pack 4.

/app/node_modules/tapable/lib/Tapable.js:63
                throw new Error(`Plugin could not be registered at '${name}'. Hook was not found.\n` +
        ^
Error: Plugin could not be registered at 'module'. Hook was not found.
BREAKING CHANGE: There need to exist a hook at 'this.hooks'. To create a compatiblity layer for this hook, hook into 'this._pluginCompat'.
    at Compiler.plugin (/app/node_modules/tapable/lib/Tapable.js:63:9)
    at Compiler.deprecated [as plugin] (internal/util.js:53:15)
    at ModulesInRootPlugin.apply (/app/node_modules/enhanced-resolve/lib/ModulesInRootPlugin.js:15:11)
    at Compiler.apply (/app/node_modules/tapable/lib/Tapable.js:71:16)
    at Compiler.deprecated [as apply] (internal/util.js:53:15)
    at PathPlugin.apply (/app/node_modules/awesome-typescript-loader/src/paths-plugin.ts:115:22)
    at webpack (/app/node_modules/webpack/lib/webpack.js:37:12)
    at startDevServer (/app/node_modules/webpack-dev-server/bin/webpack-dev-server.js:379:16)
    at processOptions (/app/node_modules/webpack-dev-server/bin/webpack-dev-server.js:361:5)
    at Object.<anonymous> (/app/node_modules/webpack-dev-server/bin/webpack-dev-server.js:504:1)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
    at Function.Module.runMain (module.js:703:10)
niemyjski commented 6 years ago

Has anyone found a work around for this? I'm also hitting the issue with #541 on incremental rebuilds

lucho78 commented 6 years ago

Same problem for me with Webpack 4.0.1 and the latest version of the plugin.

kevupton commented 6 years ago

Problems with v4.0.0-0 Webpack version 4.0.1

at-loader]: Child process failed to process the request:  TypeError: compiler.createWatchProgram is not a function
[0]     at createWatch (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:144:19)
[0]     at processInit (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:312:11)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:593:6
[0]     at Object.send (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:48:6)
[0]     at Checker.req (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\checker.ts:100:15)
[0]     at new Checker (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\checker.ts:78:8)
[0]     at Object.ensureInstance (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\instance.ts:139:18)
[0]     at compiler (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\index.ts:47:19)
[0]     at Object.loader (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\index.ts:16:12)
[0]     at LOADER_EXECUTION (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:119:14)
[0]     at runSyncOrAsync (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:120:4)
[0]     at iterateNormalLoaders (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:229:2)
[0]     at iterateNormalLoaders (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:218:10)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:233:3
[0]     at context.callback (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
[0]     at Object.module.exports (E:\xampp\htdocs\flinch-frontend\node_modules\tslint-loader\index.js:141:3)
[0]     at LOADER_EXECUTION (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:119:14)
[0]     at runSyncOrAsync (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:120:4)
[0]     at iterateNormalLoaders (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:229:2)
[0]     at Array.<anonymous> (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:202:4)
[0]     at Storage.finished (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
[0]     at provider (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\graceful-fs\graceful-fs.js:78:16
[0]     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
[0] [at-loader]: Child process failed to process the request:  TypeError: Cannot read property 'updateRootFileNames' of undefined
[0]     at getProgram (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:150:10)
[0]     at getEmitOutput (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:394:19)
[0]     at emit (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:413:24)
[0]     at processEmit (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:448:22)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:602:6
[0]     at Object.send (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:48:6)
[0]     at Checker.req (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\checker.ts:100:15)
[0]     at Checker.emitFile (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\checker.ts:105:15)
[0]     at transform (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\index.ts:132:26)
[0]     at transformationFunction (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\index.ts:74:40)
[0]     at compiler (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\index.ts:85:21)
[0]     at Object.loader (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\index.ts:16:12)
[0]     at LOADER_EXECUTION (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:119:14)
[0]     at runSyncOrAsync (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:120:4)
[0]     at iterateNormalLoaders (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:229:2)
[0]     at iterateNormalLoaders (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:218:10)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:233:3
[0]     at context.callback (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
[0]     at Object.module.exports (E:\xampp\htdocs\flinch-frontend\node_modules\tslint-loader\index.js:141:3)
[0]     at LOADER_EXECUTION (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:119:14)
[0]     at runSyncOrAsync (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:120:4)
[0]     at iterateNormalLoaders (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:229:2)
[0]     at Array.<anonymous> (E:\xampp\htdocs\flinch-frontend\node_modules\loader-runner\lib\LoaderRunner.js:202:4)
[0]     at Storage.finished (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
[0]     at provider (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\graceful-fs\graceful-fs.js:78:16
[0]     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
[0] [at-loader]: Child process failed to process the request:  TypeError: Cannot read property 'getProgram' of undefined
[0]     at getProgram (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:152:16)
[0]     at processFiles (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:458:11)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:608:6
[0]     at Object.send (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\runtime.ts:48:6)
[0]     at Checker.req (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\checker.ts:100:15)
[0]     at Checker.getFiles (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\checker\checker.ts:141:15)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\instance.ts:469:34
[0]     at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:16:1)
[0]     at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
[0]     at compilation.seal.err (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Compiler.js:467:30)
[0]     at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
[0]     at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
[0]     at hooks.optimizeAssets.callAsync.err (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Compilation.js:957:35)
[0]     at _err0 (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:11:1)
[0]     at LastCallWebpackPlugin.process (E:\xampp\htdocs\flinch-frontend\node_modules\last-call-webpack-plugin\index.js:126:12)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\last-call-webpack-plugin\index.js:197:12
[0]     at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:7:1)
[0]     at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
[0]     at hooks.optimizeChunkAssets.callAsync.err (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Compilation.js:948:32)
[0]     at _err0 (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:11:1)
[0]     at LastCallWebpackPlugin.process (E:\xampp\htdocs\flinch-frontend\node_modules\last-call-webpack-plugin\index.js:126:12)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\last-call-webpack-plugin\index.js:194:12
[0]     at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:7:1)
[0]     at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
[0]     at hooks.additionalAssets.callAsync.err (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Compilation.js:943:36)
[0]     at _err0 (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:11:1)
[0]     at compilation.hooks.additionalAssets.tapAsync.assetCb (E:\xampp\htdocs\flinch-frontend\node_modules\extract-text-webpack-plugin\dist\index.js:330:9)
[0]     at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:7:1)
[0]     at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
[0]     at hooks.optimizeTree.callAsync.err (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Compilation.js:939:32)

However works with awesome-typescript-loader@3.5.0, except when the watch triggers an update

E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\instance.ts:73
[0]      if (!compiler._tsInstances) {
[0]                    ^
[0] TypeError: Cannot read property '_tsInstances' of undefined
[0]     at resolveInstance (E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\instance.ts:73:20)
[0]     at E:\xampp\htdocs\flinch-frontend\node_modules\awesome-typescript-loader\src\instance.ts:366:26
[0]     at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:16:1)
[0]     at AsyncSeriesHook.lazyCompileHook [as _callAsync] (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
[0]     at Watching._go (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Watching.js:40:32)
[0]     at Watching._invalidate (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Watching.js:164:9)
[0]     at watcher.compiler.watchFileSystem.watch (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\Watching.js:135:10)
[0]     at Watchpack.watcher.once (E:\xampp\htdocs\flinch-frontend\node_modules\webpack\lib\node\NodeWatchFileSystem.js:43:4)
[0]     at Object.onceWrapper (events.js:317:30)
[0]     at emitTwo (events.js:126:13)
[0]     at Watchpack.emit (events.js:214:7)
[0]     at Watchpack._onTimeout (E:\xampp\htdocs\flinch-frontend\node_modules\watchpack\lib\watchpack.js:142:7)
[0]     at ontimeout (timers.js:475:11)
[0]     at tryOnTimeout (timers.js:310:5)
[0]     at Timer.listOnTimeout (timers.js:270:5)
ruaanvds commented 6 years ago

Getting the same error as @kevupton.

Versions:

ChrisTucker2000 commented 6 years ago

I'm getting the same error (TypeError: Cannot read property '_tsInstances' of undefined).

Is there any fix for this yet? I might have to look into migrating to ts-loader if it works there. I hope migrating isn't too much trouble.

Edit: I tried installing awesome-typescript-loader@next but it just fails to install with various errors. ts-loader it is then...

vincentw56 commented 6 years ago

@ChrisTucker2000 Installing @next worked for me. The biggest issue now is that incremental builds don't work. I have to manually rebuild which kills productivity.

niemyjski commented 6 years ago

Same

lucho78 commented 6 years ago

I tested the version 4.0.0-1 and the loading of the libraries dom and es2015 does not work anymore. Here the error message: ERROR in [at-loader] TS6053: File 'C:/lib.dom.d.ts' not found. ERROR in [at-loader] TS6053: File 'C:/lib.es2015.d.ts' not found.

pkoecker commented 6 years ago

I have the same problem. I tried to use ts-loader like @s-panferov and @ChrisTucker2000 suggested. It was easy to configure and it automatically rebuilds just fine, it is however incredibly slow for me (~3 Min. vs 20 Sec. of a-t-l).

sherlock1982 commented 6 years ago

Here's a patch which you can apply with patch-package. It should do the job for version 3.5.0. File should be named patches/awesome-typescript-loader+3.5.0.patch

patch-package
--- a/node_modules/awesome-typescript-loader/dist/instance.js
+++ b/node_modules/awesome-typescript-loader/dist/instance.js
@@ -213,10 +212,11 @@ var filterMtimes = function (mtimes) {
 };
 function setupWatchRun(compiler, instanceName) {
     compiler.plugin('watch-run', function (watching, callback) {
-        var instance = resolveInstance(watching.compiler, instanceName);
+        var compiler = watching.compiler || watching;
+        var instance = resolveInstance(compiler, instanceName);
         var checker = instance.checker;
-        var watcher = watching.compiler.watchFileSystem.watcher
-            || watching.compiler.watchFileSystem.wfs.watcher;
+        var watcher = compiler.watchFileSystem.watcher ||
+            compiler.watchFileSystem.wfs.watcher;
         var startTime = instance.startTime || watching.startTime;
         var times = filterMtimes(watcher.getTimes());
         var lastCompiled = instance.compiledFiles;
Delagen commented 6 years ago

@vincentw56 Tried to install next, but it cause many typechecker errors which does not occur on 3.5.0.

pamtbaau commented 6 years ago

@sherlock1982 Patch seems to work. Thanks!

sherlock1982 commented 6 years ago

Sorry seems that version 5.0.0-0 now doesn't work anymore for me. Approx. 1200 errors starting with this. Don't really understand why it looks for lib.dom.d.ts in C:/. 3.5.0 worked ok.

ERROR in [at-loader] TS6053: File 'C:/lib.dom.d.ts' not found.

ERROR in [at-loader] TS6053: File 'C:/lib.es2015.d.ts' not found.

ERROR in [at-loader] TS2318: Cannot find global type 'Array'.

ERROR in [at-loader] TS2318: Cannot find global type 'Boolean'.

ERROR in [at-loader] TS2318: Cannot find global type 'IArguments'.
s-panferov commented 6 years ago

Hello everybody, do you know some public projects that use TypeScript & Webpack4 I can use for debugging purposes?

sherlock1982 commented 6 years ago

You can check AngualarStarter. It's still Webpack3 but easily upgradeable and uses AwesomeTypescriptLoader. Currentyl I ended up using 3.5.0 + my patch and it works ok.

pamtbaau commented 6 years ago

ATS 5.0.0-0 is working fine for me.

vincentw56 commented 6 years ago

@pamtbaau It works on the initial build, but on incremental builds using "watch", it does not work.

pamtbaau commented 6 years ago

@vincentw56 That might be in your app... In mine it works fine in both initial and watch cycle.

Delagen commented 6 years ago

@pamtbaau No it does not work even on initial build as for me with the same many errors as @sherlock1982 writes before

sanex3339 commented 6 years ago

@s-panferov you can test on this project: https://github.com/javascript-obfuscator/javascript-obfuscator/tree/webpack-4

vladimiry commented 6 years ago

@sanex3339 this project doesn't have TsConfigPathsPlugin plugin enabled, but it also needs to be verified.

pamtbaau commented 6 years ago

Tested at-loader 5.0.0-0 on another project of mine and it is working fine in both initial and watch cycle.

Have a look at angular5-electron-sqlite3-bootstrap4-webpack

amitdahan commented 6 years ago

5.0.0-0 fixed it for me. Thanks!

Pegase745 commented 6 years ago

Thanks, 5.0 does the job for me too on my boilerplate.

amitdahan commented 6 years ago

Actually just found a case where it's not working yet, a different project, weird.

lucho78 commented 6 years ago

Same problem than before with version 5.0.0-0 ERROR in [at-loader] TS6053: File 'C:/lib.dom.d.ts' not found.

ERROR in [at-loader] TS6053: File 'C:/lib.es2015.d.ts' not found.

flut1 commented 6 years ago

I have the same on 5.0.0-0:

[at-loader] TS6053: File 'C:/lib.dom.d.ts' not found.
[at-loader] TS6053: File 'C:/lib.dom.iterable.d.ts' not found.
[at-loader] TS6053: File 'C:/lib.es2015.d.ts' not found.
[at-loader] TS6053: File 'C:/lib.scripthost.d.ts' not found.

Followed by a lot of errrors from modules not being able to find standard lib types. However, I solved it by removing the explicit lib configuration from my tsconfig.json. Looks like there is something going wrong in resolving the paths to these library files.

lucho78 commented 6 years ago

If I remove the lib, I get other problems, for example: ERROR in [at-loader] ./node_modules/@angular/core/src/di/reflective_provider.d.ts:87:123 TS2304: Cannot find name 'Map'.

ERROR in [at-loader] ./node_modules/@angular/core/src/di/reflective_provider.d.ts:87:165 TS2304: Cannot find name 'Map'.

flut1 commented 6 years ago

@lucho78 Unfortunately removing the lib config is not always a solution. It can only be done if you use the default set of libs. For most of my projects I need something different than the default.

Are you targeting ES5? The Map type is only included by default when using "target": "ES6" or above.

lucho78 commented 6 years ago

@flut1 I must be IE11 compliant

flut1 commented 6 years ago

@Delagen I'm not entirely sure what you mean. The default lib setting does differ per target. See --lib option in the compiler options documentation

Again, I'm not suggesting that everyone should remove the lib option. Just saying that it's a temporary solution that worked for me as I'm using the default libs.

vincentw56 commented 6 years ago

Just tested this with 5.0.0-0 and it is working fine now.

sherlock1982 commented 6 years ago

@s-panferov I modified one of your specs to demonstrate the issue.

s-panferov commented 6 years ago

@sherlock1982 thanks, this is helpful

s-panferov commented 6 years ago

It looks like the problem is only on Windows environments. So I cannot fix it quickly, because it's very hard to investigate windows problems on macos environment. Webpack works bad in virtual environments.

sherlock1982 commented 6 years ago

I will check tomorrow if I have time. If you can give me any hints where to look that would be awesome.

niemyjski commented 6 years ago

@s-panferov I ran into all the incremental build issues on osx.

ruaanvds commented 6 years ago

Can also confirm, 5.0.0-0 is working perfectly. It's very slow however (over 10secs for a recompile) - and this is just on a small boilerplate that I'm testing it out on. Anyone else getting this?

vincentw56 commented 6 years ago

@ruaanvds It is just as fast as it was before on mine. I have a very large project that I am working on and it recompiles within seconds.

ruaanvds commented 6 years ago

Thanks, @vincentw56. It's probably misconfiguration on my part. Will dig around a bit more.