@angular ivy issue
When I use the ng cli, it compiles the modules as esm2015, my problem is that I have an old system since angular 2 times and I use webpack, but for me it compiles to es5.
How can I change it to compile to esm2015?
my tsconfig.aot.json:
{
"compilerOptions": {
"rootDir": ".",
"baseUrl": ".",
"skipLibCheck": true,
"outDir": "build/aot",
"target": "es2015",
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"lib": [
"es2018",
"dom"
],
"paths": {
"corifeus-web-material": [
"build-modules/corifeus-web-material/index.ts"
],
"corifeus-web": [
"build-modules/corifeus-web/index.ts"
],
"corifeus-web-material/*": [
"build-modules/corifeus-web-material/*"
],
"corifeus-web/*": [
"build-modules/corifeus-web/*"
]
}
},
"include": [
"build-modules/**/*",
"src/angular/**/*",
"test/angular-webpack/**/*"
],
"exclude": [
"src-save",
"*.worker.js",
"src/angular/bundle.ts",
"test/angular-webpack/angular/bundle.ts",
"test/angular-karma",
"build/browser",
"node_modules/corifeus-web/test",
"node_modules/corifeus-web-material/test"
],
"angularCompilerOptions-save": {
"annotationsAs": "decorators",
"preserveWhitespaces": false
},
"angularCompilerOptions": {
"enableIvy": true
}
}
git clone https://github.com/patrikx3/corifeus-app-web-pages
cd corifeus-app-web-pages
npm install
grunt
output:
Running "cory-build-aot" task
Compiling @angular/core : module as esm5
Compiling @angular/common : module as esm5
Compiling @angular/common/http : module as esm5
Compiling @angular/animations : module as esm5
Compiling @angular/animations/browser : module as esm5
Compiling @angular/animations/browser/testing : module as esm5
Compiling @angular/cdk/platform : module as esm5
Compiling @angular/cdk/coercion : module as esm5
Compiling @angular/cdk/bidi : module as esm5
Compiling @angular/cdk/collections : module as esm5
Compiling @angular/cdk/scrolling : module as esm5
Compiling @angular/cdk/drag-drop : module as esm5
Compiling @angular/common/http/testing : module as esm5
Compiling @angular/cdk/keycodes : module as esm5
Compiling @angular/cdk/observers : module as esm5
Compiling @angular/cdk/a11y : module as esm5
Compiling @angular/platform-browser : module as esm5
Compiling @angular/cdk : module as esm5
Compiling @angular/platform-browser/animations : module as esm5
Compiling @angular/material/core : module as esm5
Compiling @angular/cdk/portal : module as esm5
Compiling @angular/cdk/overlay : module as esm5
Compiling @angular/forms : module as esm5
Compiling @angular/material/form-field : module as esm5
Compiling @angular/material/autocomplete : module as esm5
Compiling @angular/material/badge : module as esm5
Compiling @angular/cdk/layout : module as esm5
Compiling @angular/material/bottom-sheet : module as esm5
Compiling @angular/material/button : module as esm5
Compiling @angular/material/button-toggle : module as esm5
Compiling @angular/material/card : module as esm5
Compiling @angular/material/checkbox : module as esm5
Compiling @angular/material/chips : module as esm5
Compiling @angular/material/dialog : module as esm5
Compiling @angular/cdk/text-field : module as esm5
Compiling @angular/material/input : module as esm5
Compiling @angular/material/datepicker : module as esm5
Compiling @angular/material/divider : module as esm5
Compiling @angular/cdk/accordion : module as esm5
Compiling @angular/material/expansion : module as esm5
Compiling @angular/material/grid-list : module as esm5
Compiling @angular/material/icon : module as esm5
Compiling @angular/material/list : module as esm5
Compiling @angular/material/menu : module as esm5
Compiling @angular/material/select : module as esm5
Compiling @angular/material/tooltip : module as esm5
Compiling @angular/material/paginator : module as esm5
Compiling @angular/material/progress-bar : module as esm5
Compiling @angular/material/progress-spinner : module as esm5
Compiling @angular/material/radio : module as esm5
Compiling @angular/material/sidenav : module as esm5
Compiling @angular/material/slide-toggle : module as esm5
Compiling @angular/material/slider : module as esm5
Compiling @angular/material/snack-bar : module as esm5
Compiling @angular/material/sort : module as esm5
Compiling @angular/cdk/stepper : module as esm5
Compiling @angular/material/stepper : module as esm5
Compiling @angular/cdk/table : module as esm5
Compiling @angular/material/table : module as esm5
Compiling @angular/material/tabs : module as esm5
Compiling @angular/material/toolbar : module as esm5
Compiling @angular/cdk/tree : module as esm5
Compiling @angular/material/tree : module as esm5
Compiling @angular/material : module as esm5
Compiling @angular/core/testing : module as esm5
Compiling @angular/platform-browser-dynamic : module as esm5
Compiling @angular/platform-browser/testing : module as esm5
Compiling @angular/compiler/testing : module as esm5
Compiling @angular/platform-browser-dynamic/testing : module as esm5
Compiling @angular/common/testing : module as esm5
Compiling @angular/router : module as esm5
Compiling @angular/router/testing : module as esm5
is it an error? i should be getting esm2015 module compiling.
not directly error, but i target for esm2015
Angular Version: 8.1.2
Anything else relevant?
build error, i am expecting like :
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
For me this started showing after upgrading to Angular 9, and adding
"postinstall": "ngcc"
to scripts in package.json
fixed it.
ok,i, found it, in webpack i had to set [ 'es2015', 'browser', 'module', 'main'],,
https://github.com/angular/angular/issues/31853#issuecomment-515406475
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With