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

[Bug] Angular-cli 8.1 insists on building for es5 while I want only es2015 #14991

Closed
zijianhuang opened this issue Jul 4, 2019 · 5 comments
Closed

Comments

@zijianhuang
Copy link

🐞 Bug report

Command (mark with an x)

- [ x] build

Description

I want es2015 codes only for my LOB app running on Chrome primarily though Firefox and Edge may be supported. I had done respective config in tsconfig.json and package.json.

🔬 Minimal Reproduction

Prerequisites:
Angular 8.1
Angular CLI 8.1

In package.json, I have:

	"browserslist": [
		"last 2 versions",
		"Firefox ESR",
		"not dead",
		"not IE 9-11"
	],

as suggested in https://github.com/browserslist/browserslist

In tsconfig.json,

{
	"compileOnSave": false,
	"compilerOptions": {
		"baseUrl": "./",
		"outDir": "./dist/out-tsc",
		"sourceMap": true,
		"declaration": false,
		"moduleResolution": "node",
		"emitDecoratorMetadata": true,
		"experimentalDecorators": true,
		"target": "es2015",
		"typeRoots": [
			"node_modules/@types"
		],
		"lib": [
			"es2018",
			"dom"
		],
		"skipLibCheck": true
	}
}

🔥 Exception or Error

Both es5 and es2015 codes are produced, while https://angular.io/guide/deployment#differential-loading suggested a single build.

@mgechev
Copy link
Member

mgechev commented Jul 4, 2019

last 2 versions triggers the ES5 build. Which part of the documentation suggests a single build?

@zijianhuang
Copy link
Author

@mgechev ,
"Configuring differential loading" in https://angular.io/guide/deployment#differential-loading
and there's a table:
ES5 BROWSERSLIST RESULT | ES TARGET | BUILD RESULT
indicating "Single Build". -- "If you ignore browsers without ES2015 support, a single build is produced."

@alan-agius4
Copy link
Collaborator

Hi @zijianhuang, indeed that a single build when ES5 support is not needed but with your browserslist query you are stating that you want ES5 support.

You should be more specific in your query and specify the browsers that you want to support example;

last 2 Chrome versions
last 2 Safari versions
last 2 Firefox versions

Thanks.

@earshinov
Copy link

earshinov commented Jul 7, 2019

@zijianhuang , The proper answer is that you have to exclude Edge from browserslist, even though you support it. See #14580

Update: An even better option is to upgrade to @angular/cli 8.1.0 where the problem with Edge is fixed, thanks to @alan-agius4 .

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants