Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5 webpack compilation error

After upgrading to Angular 5 and Cli 1.5, on ng serve I am getting an error:

ERROR in ./node_modules/@stomp/ng2-stompjs/index.ts
    Module build failed: Error: ...\project\node_modules\@stomp\ng2-stompjs\index.ts is not part of the compilation output. Please check the other error messages for details.
        at AngularCompilerPlugin.getCompiledFile (...\project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
        at plugin.done.then (...\project\node_modules\@ngtools\webpack\src\loader.js:467:39)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:188:7)
     @ ./src/app/app.module.ts 27:0-63
     @ ./src/main.ts
     @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

I have tried to add include to my tsconfig.app.json so it looks like this:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "types": []
  },
  "include": [
    "../node_modules/@stomp/**/*.ts"
  ],
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

I tried re-run ng serve I got another error:

    ERROR in ./src/main.ts
Module build failed: Error: ...project\chatAngular4\src\main.ts is not part of the compilation output. Please check the other error messages for details.
    at AngularCompilerPlugin.getCompiledFile (...project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
    at plugin.done.then (...project\node_modules\@ngtools\webpack\src\loader.js:467:39)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: Error: C:\Users\MEP2\Desktop\chatAngular4\src\polyfills.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (...project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:624:23)
    at plugin.done.then (...project\node_modules\@ngtools\webpack\src\loader.js:467:39)
    at <anonymous>
 @ multi ./src/polyfills.ts

This looks like it needs some kind of generic workaround. Any ideas?


Update

After updating all packages to latest version, problem disapeared

like image 907
tprieboj Avatar asked Nov 05 '17 14:11

tprieboj


1 Answers

Try ng serve --preserve-symlinks.

It helps in most cases for current version of Angular.

Or else simply don't run ng serve from symbolically linked folder. Run it from the real one.

Looking forward when they fix it.

like image 194
zhekaus Avatar answered Oct 21 '22 01:10

zhekaus