-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Closed
Copy link
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimetype: bug/fix
Description
I'm submitting a ...
[x] bug report
Current behavior
Running @angular/compiler
in PhantomJS results in an error:
Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.
The offending code can be found in @angular/compiler/bundles/compiler.umd.js:26587
:
JitCompiler.prototype._createCompiledHostTemplate = function (compType, ngModule) {
if (!ngModule) {
throw new Error("Component " + stringify(compType) + " is not part of any NgModule or the module has not been imported into your module.");
}
var /** @type {?} */ compiledTemplate = this._compiledHostTemplateCache.get(compType);
if (!compiledTemplate) {
var /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(compType);
assertComponent(compMeta);
var HostClass_1 = (function () {
function HostClass_1() {
}
HostClass_1.overriddenName = identifierName(compMeta.type) + "_Host";
return HostClass_1;
}());
function HostClass_tsickle_Closure_declarations() {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/** @type {?} */
HostClass_1.overriddenName;
}
var /** @type {?} */ hostMeta = createHostComponentMeta(HostClass_1, compMeta);
compiledTemplate = new CompiledTemplate(true, compMeta.selector, compMeta.type, hostMeta, ngModule, [compMeta.type]);
this._compiledHostTemplateCache.set(compType, compiledTemplate);
}
return compiledTemplate;
};
Expected behavior
The code should run in PhantomJS
Minimal reproduction of the problem with instructions
See tsvetomir/phantomjs-angular-2.3 for a runnable sample.
git clone git@github.com:tsvetomir/phantomjs-angular-2.3.git
cd phantomjs-angular-2.3
npm install
./node_modules/.bin/phantomjs script.js
What is the motivation / use case for changing the behavior?
The shipped code shouldn't violate Strict Mode restrictions.
Please tell us about your environment:
-
Angular version: 2.3.0
-
Browser: PhantomJS 2.1.7
-
Language: TypeScript 2.1
-
Node (for AoT issues): 4.7
rkonstantinov, KirilNN, rusev, r3hensler, kvet and 28 more
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimetype: bug/fix