-
Notifications
You must be signed in to change notification settings - Fork 25.4k
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
Unable to view AngularJS 2.0 Beta 1 in Internet Explorer: The use of a keyword for an identifier is invalid #6501
Comments
The Internet Explorer version is 11 (11.0.9600.18125CO) with rendering engine set to Edge. |
Same for me. Here is the example in Plunker. It will works in IE 11/10 only if you change all "beta.1" to "beta.0" |
I am not sure how you found bug #213, I specifically tried "The use of a keyword for an identifier is invalid" as a search criteria and found nothing. Anyways, I updated the title just in-case the body of these bug reports are not very searchable. |
I see why I never found it, because I searched angular/angular rather than angular. |
Same with me. And if my root component contains another component in its view markup then I also get the "SyntaxError: Expected ';'" exception. This happens only in IE11 (ok in Chrome/FF/Edge) and it was not the issue in Beta.0. |
I think the
I don't know how or why they are there, but these keys are then used to populate the |
I further traced it down to directive name in the metadata being incorrect. For some reason in IE11 |
While trying to figure out why the compiler was creating incorrect directive metadata, the issue just suddenly fixed itself on my computer and everything works. For those who are still experiencing the issue, can you try fully clearing cache or using incognito mode to see if it still reproduces? Anybody have any insight as to why the type name of a directive would include the first line of the entire function declaration? |
Same here for me. I got just a simple view, and that fails on IE11. |
I tried your example from plunker, it works in Chrome but not in IE (11.0.9600.18097). Having the same issue "SyntaxError: The use of a keyword for an identifier is invalid" on "angular2.dev.js:452:5": Clearing IE cache didn't solve the problem. Using angular2 beta 0 I get the same error but at a different location.. angular2.dev.js:23969:9: |
Dup of #6450? |
+1. beta.0 is fine thought. |
+1 |
Ok, mine is the dup :) Let me just quote #6450 for reference: In beta.1 (so 7ae23ad is likely the culprit) in IE11, the generated JavaScript from jitting contains syntax errors: var appProtoView0_function SvgDefsImpl() {}0 = AppProtoView.create(resolvedMetadataCache, 1, [], {});
var renderType56_function SvgDefsImpl() {} = null;
var styles57_function SvgDefsImpl() {} = styles; Instead of a sanitized name, |
I found that in lang.ts, the stringify function returns the entire first line of the token when the token.name is undefined (IE does not support function.name) so the returned value is function functionName(arg) { Therefore the identifier is named function which is, of course, a keyword. I have verified that the problem is fixed if I add the following:
to the stringify function, but it seems like it might be more appropriate to create an IE specific shim to address the missing name property. |
We have this shim in the repo as |
@Mlaval I have been using your IE shims file for my tests on sauce labs, and my builds are still broken on all versions of IE with Beta 1. I'm not sure I can create a Plunkr of it, but you can see my Travis/Sauce sadness here: https://travis-ci.org/justindujardin/ng2-material/builds/103002845 Here's the (sparse) stack trace information:
|
Adding the function name shim in |
I'm not sure if this is fixed or not (hard to follow the thread), but I see the same issue on IE 11 (11.162.10586.0 Win 10). 2.0.0-beta.7 |
As suggested, fixed it by adding https://github.com/angular/angular/blob/master/modules/angular2/src/testing/shims_for_IE.js#L1-L14 to the code. |
Any particular reason these shims aren't part of angular-polyfills? I'm a bit reluctant to pull code from the bowels of the lib since it feels 'unofficial'. Also the current |
@SethDavenport that's being discussed over here #7390 |
@SethDavenport, people over at angular webpack starter project have made a https://github.com/gdi2290/ie-shim project that can be integrated in webpack. If you look at their config file they use it in there. However, it doesn't have the @justindujardin version but the original one with causes some problem with the regexp. I'm assuming @gdi2290 might be waiting for the pull reference above before updating that file... I personally just patch the code myself until it all gets squared off. |
Thanks, I'll check it out. In my case it turned out to be tsconfig settings that were messing webpack up. |
@user414 FWIW I ended up doing this: https://github.com/rangle/angular2-redux-starter/pull/81/files
Thanks for the tips. |
Looks to me like there are a few issues lumped together here, can someone clarify?
In #7825 I fixed the latter one, only in the case of the template compiler doing codegen (because we found that closure compiler drops class names when lowering es6 to es5). If you're using TypeScript or Babel to produce ES5, you don't have this problem. Also my fix produces an opaque identifier like |
My IE experience: I use the modified IE shim that @justindujardin posted above Other than that, everything else comes from a polyfill service (to also support Safari with Intl) and core.js (which is only required by IE). The only pieces of core.js actually needed by IE appear to be: core-js/es6/array But this was pre-zone 0.6.8 / beta.13 fixes where I now pull in zone directly instead of using angular2-polyfills. So core.js is also now supplying reflect-metadata as well so I just pull in core.js from a CDN for the time being instead of trying to load a cut-down version of it. Everything is built with webpack and uglified but without mangle. Source here in case it helps anyone: https://github.com/CaptainCodeman/angular2-webpack-polyfill |
here's the mangle config to get everything working with minify mangle: {
screw_ie8 : true,
keep_fnames: true
} |
Thanks you so much - that works great !! (although strangely, it seems to have less of an impact on large codebases than smaller ones) |
Fixed by #6944 |
|
* Add Environment Configuration to TOC Adds a link to the environment configuration to the table of contents. * Reorder angular packages alphabetically Reorders the angular packages alphabetically in the seed.config.ts (SystemJS, System Builder) and test-main.js to be in accordance to order in the package.json. * Update Route Configuration for lazy loaded components Updates the route configuration for the +about and +home lazy loaded component according to the angular guide (see: https://angular.io/docs/ts/latest/guide/router.html). Furthermore removes the index property which was deprecated with @angular/router 3.0.0-alpha.7. Now, the `path: ''` indicates the index of a route. * Remove workaround for angular upstream issue in index.html Removes the workaround present in the index.html that was made because of the angular issue #6501 (angular/angular#6501). For information on the fix, see here: angular/angular#6501 (comment)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I am unable to render AngularJS 2.0 Beta 1 in Internet Explore.
I have stripped down a page to as small as possible and can reproduce the issue where all I have as an empty app component that references an html page.
Downgrading to Angular JS 2.0 Beta 0 resolves the issue.
Below is the stack trace of the error:
HTML1300: Navigation occurred.
File: localhost:8000
EXCEPTION: SyntaxError: The use of a keyword for an identifier is invalid
EXCEPTION: SyntaxError: The use of a keyword for an identifier is invalid
STACKTRACE:
SyntaxError: The use of a keyword for an identifier is invalid
at evalExpression (http://localhost:8000/lib/js/angular2.dev.js:452:5)
at TemplateCompiler.prototype._createViewFactoryRuntime (http://localhost:8000/lib/js/angular2.dev.js:23969:9)
at Anonymous function (http://localhost:8000/lib/js/angular2.dev.js:23924:13)
at run (http://localhost:8000/lib/js/angular2-polyfills.js:138:7)
at Anonymous function (http://localhost:8000/lib/js/angular2.dev.js:13247:15)
at zoneBoundFn (http://localhost:8000/lib/js/angular2-polyfills.js:111:7)
at lib$es6$promise$$internal$$tryCatch (http://localhost:8000/lib/js/angular2-polyfills.js:1511:9)
at lib$es6$promise$$internal$$invokeCallback (http://localhost:8000/lib/js/angular2-polyfills.js:1523:9)
at Anonymous function (http://localhost:8000/lib/js/angular2-polyfills.js:2071:13)
at Anonymous function (http://localhost:8000/lib/js/angular2-polyfills.js:243:5)
-----async gap-----
Error
at _getStacktraceWithCaughtError (http://localhost:8000
SyntaxError: The use of a keyword for an identifier is invalid
{
[functions]: ,
proto: { },
description: "The use of a keyword for an identifier is invalid",
message: "The use of a keyword for an identifier is invalid",
name: "SyntaxError",
number: -2146827240,
stack: "SyntaxError: The use of a keyword for an identifier is invalid
at evalExpression (http://localhost:8000/lib/js/angular2.dev.js:452:5)
at TemplateCompiler.prototype._createViewFactoryRuntime (http://localhost:8000/lib/js/angular2.dev.js:23969:9)
at Anonymous function (http://localhost:8000/lib/js/angular2.dev.js:23924:13)
at run (http://localhost:8000/lib/js/angular2-polyfills.js:138:7)
at Anonymous function (http://localhost:8000/lib/js/angular2.dev.js:13247:15)
at zoneBoundFn (http://localhost:8000/lib/js/angular2-polyfills.js:111:7)
at lib$es6$promise$$internal$$tryCatch (http://localhost:8000/lib/js/angular2-polyfills.js:1511:9)
at lib$es6$promise$$internal$$invokeCallback (http://localhost:8000/lib/js/angular2-polyfills.js:1523:9)
at Anonymous function (http://localhost:8000/lib/js/angular2-polyfills.js:2071:13)
at Anonymous function (http://localhost:8000/lib/js/angular2-polyfills.js:243:5)"
}
The text was updated successfully, but these errors were encountered: