The Wayback Machine - http://web.archive.org/web/20210809183835/https://github.com/angular/angular-cli/issues/21507
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build with modules only #21507

Closed
1 of 15 tasks
muuvmuuv opened this issue Aug 5, 2021 · 4 comments
Closed
1 of 15 tasks

Cannot build with modules only #21507

muuvmuuv opened this issue Aug 5, 2021 · 4 comments

Comments

@muuvmuuv
Copy link
Task lists! Give feedback

@muuvmuuv muuvmuuv commented Aug 5, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

I guess

Description

I am trying to build our app for modern browsers only (only type=module) but cannot get it working. Using a fresh ng new does not even work. I have created a browserslist in the root containing only "last 2 chrome versions" and left the target at "es2017" (ng g application did that). Even using "es2015" does not work.

🔬 Minimal Reproduction

  1. ng new test --defaults --no-create-application
  2. cd test
  3. ng g application test --defaults
  4. echo "last 1 Chrome version" > .browserslistrc
  5. ng build
  6. cat dist/test/browser/index.html
  7. No es6 modules generated

🔥 Exception or Error


None

🌍 Your Environment


Angular CLI: 12.2.0
Node: 12.22.2
Package Manager: npm 6.14.13
OS: win32 x64

Angular: 12.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.0
@angular-devkit/build-angular   12.2.0
@angular-devkit/core            12.2.0
@angular-devkit/schematics      12.2.0
@schematics/angular             12.2.0
rxjs                            6.6.7
typescript                      4.3.5

Anything else relevant?

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Aug 5, 2021

This has been added in version 13, See: #21484

This doesn't mean that the bundle will contain ES6 module syntax to load chunks instead of the the Webpack module loading syntax. ES6 module syntax is still experimental in Webpack https://webpack.js.org/configuration/experiments/#experimentsoutputmodule.

Just to clarify the request, are you expecting to see ES6 imports/exports in the bundles?

@muuvmuuv
Copy link
Author

@muuvmuuv muuvmuuv commented Aug 5, 2021

@alan-agius4 yes I am expecting <script type=module> in my index.html but getting <script defer> instead.

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Aug 5, 2021

In that case, this has been addressed in version 13 which is currently in pre-release stage via the linked PR above.

@alan-agius4 alan-agius4 closed this Aug 5, 2021
@muuvmuuv
Copy link
Author

@muuvmuuv muuvmuuv commented Aug 5, 2021

Okay, that are good news. Thanks. I will opt-in into the beta once its out and try it. We are using Ionic so backwards comp. is not our focus ^^.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants