Skip to content

ng build --prod generates error if target is es6 #3191

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

Closed
ddorigo opened this issue Nov 18, 2016 · 9 comments
Closed

ng build --prod generates error if target is es6 #3191

ddorigo opened this issue Nov 18, 2016 · 9 comments

Comments

@ddorigo
Copy link

ddorigo commented Nov 18, 2016

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 7

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
D:\intelliJ\testcli\cli>ng --version
angular-cli: 1.0.0-beta.20-4
node: 6.2.0
os: win32 x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
Fresh installed angular cli. Only change the target option to es6 will cause the error.
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es6", <<<<<<<<<<<<<<<<<<<<<<<<<<<
"typeRoots": [
"../node_modules/@types"
]
}
}

The log given by the failure.

Normally this include a stack trace and some more information.

ERROR in main.9e857c22c48e133aa50b.bundle.js from UglifyJs
SyntaxError: Unexpected token: name (AppComponent) [D:/intelliJ/testcli/cli/~/angular2-template-loader!D:/intelliJ/testcli/cli/src/app/app.component.ts:8,0][main.9e857c22c48e133aa50b.bundle.js:38265,4]

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

@clydin
Copy link
Member

clydin commented Nov 18, 2016

Uglifyjs (and by extension the CLI) currently doesn't support es6

@ddorigo
Copy link
Author

ddorigo commented Nov 18, 2016

Thanks for the info.

@ddorigo ddorigo closed this as completed Nov 18, 2016
@rtm
Copy link

rtm commented Mar 28, 2017

Is there any workaround? Any way to select another minifier?

@LanderBeeuwsaert
Copy link

So this means angular-cli is not compatible with es6 as a target?

@clydin
Copy link
Member

clydin commented Apr 24, 2017

@LanderBeeuwsaert At this point in time, yes.

@brandon-objectstudio
Copy link

Any roadmap on making this an option? It appears that using "uglify-es" instead of "uglify-js" would make this possible - perhaps adding an option in the angular-cli config to use this version?

I don't know the larger ramifications of this proposed change - but it seems like a reasonable option.

@kirillgroshkov
Copy link

I have similar issue, but even with target="es5" (after using pify package that is es6)

@jscharett
Copy link

Having the same issue here. I'm targeting es5, but UglifyJS errors when trying to create the vendor bundle. I'm importing a couple es6 files from my node_modules. It would be nice to either use Uglify-es or transpile files before sending them to Uglify-js without having to do an ng eject.

@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 7, 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

7 participants