UglifyJs changes ascii characters to unicode for trim polyfill
Bug Report or Feature Request (mark with an x)
- [X ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.2.0 node: 6.9.0 os: win32 x64 @angular/common: 2.4.6 @angular/compiler: 2.4.6 @angular/core: 2.4.6 @angular/forms: 2.4.6 @angular/http: 2.4.6 @angular/platform-browser: 2.4.6 @angular/platform-browser-dynamic: 2.4.6
Repro steps.
Uncomment import 'core-js/es6/string'; polyfill. Run ng build --prod Search in polyfills for "\u2028"
The log given by the failure.
"?A?".trim() returns "A"
Desired functionality.
trim polyfill should escape:
module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
But this is replaced by:
exports="\t\n\v\f\r \u2028\u2029\ufeff"
In some env, some unicode characters are replaced by ?, so now trim will remove ? from string.
Mention any other details that might be useful.
This can be avoid setting this for Uglify plugin: output: { ascii_only: true },
Could you have a look at this bug?
I can't modify the environement use to run production build, and I don't know it. But adding ascii_only would fix that.
Thanks!
Pierre
Good luck getting these guys to consider anything to do with any accommodations to environments other than their own https://github.com/angular/angular-cli/issues/6155 https://github.com/angular/angular-cli/issues/3544
I did some investigation, Angular 4 uses Ɵ (/u275) to prefix private modules. Maybe ascii_only: true can break something with those modules..
I still stand by that the CLI should support outputting unicode (instead of outputting only ascii) as I stated in https://github.com/angular/angular-cli/issues/6155#issuecomment-316324293.
If there's a way to preserved escaped characters as requested in https://github.com/angular/angular-cli/issues/3544 and in this issue, I'm all for it.
I agree not preserving them is a problem since some libraries like Angular and the core-js polyfill require them to work properly.
Please see https://github.com/angular/angular-cli/issues/6155#issuecomment-320292038 for an update on this issue.
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.