ng build --aot --prod generates ESC character in vendor
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.0.0 node: 6.10.2 os: win32 x64 @angular/common: 4.1.0 @angular/compiler: 4.1.0 @angular/core: 4.1.0 @angular/forms: 4.1.0 @angular/http: 4.1.0 @angular/platform-browser: 4.1.0 @angular/platform-browser-dynamic: 4.1.0 @angular/router: 4.1.0 @angular/cli: 1.0.0 @angular/compiler-cli: 4.1.0
Repro steps.
Create a new project with the cli
run ng build --aot --prod
check the vendor file.
Easiest way is to open the file in notepad++. Press ALT + 027 to insert the ESC char. Ctrl + C to copy and Ctrl + F to find it.
The log given by the failure.
No angular crashlog. Crashlog from IBM WebSphere. Illegal character [0x001b] found at offset [some hex value] in file [vendor.**.bundle.js]
Desired functionality.
Don't generate the ESC char but ESC as string.
Mention any other details that might be useful.
Also happend with cli 1.0.1 I added my generated vendor. Check line 529 col 10548. https://www.dropbox.com/s/d80zz1fpxy8xho4/vendor.8b1206c372ceef779894.bundle.js?dl=0
Can you provide a repro where this happens? One of your vendors seems to be doing it but I can't figure it out from just the bundle.
@filipesilva Any update on this one?
@filipesilva I can reproduce this by making a new skeleton with ng new projectname and ng build --prod and it throws errors when we push it up to our server every time. Any updates on this or a version of the CLI we can revert to in the meantime that doesn't cause this behavior?
@Fayde
As far as I know there is no version you can revert to. I wrote this simple gulp script for the meantime.
(gulpfile.js)
var gulp = require('gulp');
var replace = require('gulp-replace');
gulp.task('build', function () {
console.log('replacing characters we can\'t handle');
gulp.src(['dist/vendor.*.bundle.js'])
.pipe(replace(/\u001b/g, '\\u001b'))
.pipe(gulp.dest('dist'))
});`
Script: "build": "ng build --aot --prod && gulp build"
@robindijkhof thanks I will add it into my build chain for now
@filipesilva can we get an update on if this is being looked at or not. It's not ideal to have this step in the build chain for an enterprise-wide application and justifying to leadership that this is a necessary step but also that this is a stable application
https://github.com/angular/angular-cli/issues/3544 <-- I think this is same issue.
@chunghha it's not the same issue
@filipesilva any update please
I checked out @robindijkhof's fix in https://github.com/angular/angular-cli/pull/6951 but am sorry to say this is not something we're going to merge.
As per Uglify's documentation, turning ascii_only on can break directive names. Indeed <app-root-☺></app-root-☺> is a valid directive.
Since browsers in general support unicode, I don't think the CLI prod build pipeline should drop it.
At the moment I think the problem here is that your server does not support certain unicode characters, and I think it's reasonable for users to have an extra step (such as the gulp script) to work around limitations of that server.
Eyeroll
Hello,
Are you sure it is working? Here I have created a component with a selector using unicode character, it doesn't work.
https://plnkr.co/edit/RQ6FrdVIBJD42XqDUx9t?p=preview
@pierre-hilt it seems to be supported in the root component (the ones that goes in index.html) but not in the others. I'll double check unicode support with the team.
I was wrong - <app-root-☺> is not a valid directive name per WC3 spec and is not meant to be supported by Angular itself.
I ran a few tests to see if it was safe to turn on ascii_only and it seemed to be fine overall. Reopening #6951 for merging.
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.