I am trying to set up Angular 2 application with all the new tools (jspm 0.17.0-beta.40).
I am transpiling to System
module. Here's the tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"target": "ES5",
"module": "System",
"moduleResolution": "Node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"rootDir": "../"
}
}
The issue is with ES6 import
. After something like this is transpiled:
import { Component, ViewEncapsulation, AfterViewInit } from '@angular/core';
the use of this would be:
core_1.Component
But unfortunately, the browser running the app can't recognize it.
"TypeError: core_1.Component is not a function
at Object.execute (...app/app.component.js:32:24)
at E (...jspm_packages/system.js:4:7541)
at S (...jspm_packages/system.js:4:6746)
at S (...jspm_packages/system.js:4:6646)
at S (...jspm_packages/system.js:4:6646)
at x (...jspm_packages/system.js:4:6102)
at ...jspm_packages/system.js:5:6612"
The same type of error is raised when I use ViewEncapsulation
.
This is when transpiling to System
modules.
Transpiling with CommonJS
module works (the app passes this step).
I can't work with that though, because I use
import html from './app.component.html';
with the following meta
config:
meta: {
"*.html": {
"loader": "text"
},
}
Which fails with the error
Error: No template specified for component AppComponent
I have tried switching versions of JSPM and System.
Apparently, the changes introduced in 0.20 version of System cause this.
Any ideas on how to approach this?