Reputation: 89
When I try to load the project, the following error is thrown
./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Emit attempted before Angular Webpack plugin initialization
.
Upvotes: 7
Views: 10919
Reputation: 10547
I had the same error, but required a different resolution. Turns out I was using an unsupported version of typescript (4.9.x) I had to downgrade it to the correct 4.8.x version to get the error to clear.
Upvotes: 1
Reputation: 549
I got that error after upgrading Angular, since I ended up with invalid tsconfig. Check your tsconfig.json and your tsconfig.app.json, check any paths set (in files/include/exclude) are actually matching your environment. Either update paths or move the config files.
"files": [
"../src/main.ts", // added ../ to reflect current file structure
"../src/polyfills.ts"
],
Upvotes: 4