I'm having problem with systemJS
loading external modules. I created a small sample project for VS2015. You can download the code here https://github.com/dbiele/TypeScript-Cordova-SystemJS
When I build the project and view in Ripple or BrowserSync I get the following error: xhr_proxy
. It looks like System
is looking for the external file animate.js
on registry.jspm.io when it should be finding it on the localhost
.
Any thoughts? The code in GitHub is really basic. Note: I don't think this is a Cordova issue because I'm running in a browser and ripple.
Found the issue. TypeScript does not use the .js
extension when importing/exporting external modules. For example:
import * as Animate from './animate';
ES6
import * as Animate from './animate.js';
The solution is to add defaultJSExtensions: true
into system.config.
Example:
System.config({
baseURL: './scripts/',
paths: { 'App': 'app.js' },
defaultJSExtensions: true
});
I updated the VS2015 project code here and it works well.
https://github.com/dbiele/TypeScript-Cordova-SystemJS
@DatenMetzgerX had the same problem. Posted info: https://github.com/systemjs/systemjs/issues/490
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.