I am currently experiencing an issue that seems to occur randomly, despite everything working perfectly in my setup.
I have several Angular applications compiled with webpack. They all work fine in AOT mode but crash in JIT mode. This is because the compiler is unable to understand annotations.
compiler.js:2700 Uncaught Error: Can't resolve all parameters for ApplicationModule: (?).
at syntaxError (compiler.js:2700)
at CompileMetadataResolver._getDependenciesMetadata (compiler.js:19254)
I am using "core-js": "^2.6.5"
(I have also tried with version 3.0.1
)
In my polyfill.ts
, I have included reflections as follows:
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
My webpack configuration includes the following rules:
[
{
loader: 'babel-loader',
options: babelOptions
},
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
},
{
loader: 'angular2-template-loader'
}
]
And here is how my Babel configuration looks:
presets: [
[
'@babel/preset-env',
{
modules: false,
loose: true,
targets: {
browsers: [
"last 2 versions",
"not ie <= 10"
]
},
useBuiltIns: 'usage',
corejs: "2",
debug: false
}
]
]
What I have tried so far:
- Upgrading and downgrading core-js.
- Upgrading and downgrading Angular 7.
You can check out a minimal demonstration of the issue on this Github repository