angular / angular

Deliver web apps with confidence πŸš€
https://angular.dev
MIT License
96.17k stars 25.45k forks source link

even though i am using target esm2015, ivy is compiles as a esm5 module. #31853

Closed p3x-robot closed 5 years ago

p3x-robot commented 5 years ago

🐞 bug report

Affected Package

The issue is caused by package @angular/.... @angular ivy ### Is this a regression? no ### Description A clear and concise description of the problem... 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? ## πŸ”¬ Minimal Reproduction my tsconfig.aot.json: ```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 } } ``` ```bash git clone https://github.com/patrikx3/corifeus-app-web-pages cd corifeus-app-web-pages npm install grunt ``` output: ```text 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.

πŸ”₯ Exception or Error

not directly error, but i target for esm2015

🌍 Your Environment

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
gkalpak commented 5 years ago

Hello, we reviewed this issue and determined that it doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular.

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

That being said, you probably need to configure resolve.mainFields in your webpack config (form a very superficial look).

p3x-robot commented 5 years ago

https://stackoverflow.com/questions/57220392/even-though-i-am-using-target-esm2015-ivy-is-compiles-as-a-esm5-module/57220445#57220445

p3x-robot commented 5 years ago

@gkalpak thanks for your help! i fixed it with mainFields: [ 'es2015', 'browser', 'module', 'main'],

thousands props! :+1: :100: :1234: :1st_place_medal:

p3x-robot commented 5 years ago

i saved 300kb, but with gzip about 100kb...

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.