systemjs

How to make SystemJS transpile 'typescript' based on file extension not contents

廉价感情. 提交于 2019-12-10 17:27:57
问题 I have this SystemJS config in index.html: <body> <script src="node_modules/systemjs/dist/system.js"></script> <script> System.config({ defaultJSExtensions: true, transpiler: 'typescript', map: { typescript: 'node_modules/typescript/lib/typescript.js' }, packages: { "ts": { "defaultExtension": "ts" } }, }); System.import('ts/main'); </script> </body> main.ts: let a = [1, 2, 3]; let b = [1, 2, 3]; I get: Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet

TypeScript inheritance and circular dependencies in SystemJS

感情迁移 提交于 2019-12-10 15:56:42
问题 I'm using TypeScript with --module system (SystemJS) in a very large project. SystemJS supports cyclic dependencies, and most of the time it works fine. However, when TypeScript inheritance gets involved, things begin to break. For example, if a class A depends on class B , and class B inherits from class A , then if class A gets loaded first: It will pause class A's resolution and will try to load the class B dependency class B will think its dependencies are resolved, since class A has been

Angular 2 and Firebase SDK

泪湿孤枕 提交于 2019-12-10 15:29:16
问题 I've been trying to get the Angular2 quickstart app to work with Firebase (see this repository). I've installed the latest version of Firebase, attempted to load firebase using SystemJS (see systemjs.config.js) and tried importing firebase and using the function initializeApp (see app.component.ts). However, I keep getting the error firebase.initializeApp is not a function in the browser console. Am I using SystemJS correctly to load firebase.js ? Note : To replicate the error, you should

How to use ngx-bootstrap in Angular 4 application with SystemJs module system

隐身守侯 提交于 2019-12-10 14:49:59
问题 I have tried out many variations of specifying path for allowing SystemJS to load the ngx-bootstrap package System.config({ "defaultJSExtensions": true, "paths": { "@angular/core": "node_modules/@angular/core/bundles/core.umd.js", "@angular/forms": "node_modules/@angular/forms/bundles/forms.umd.js", "@angular/http": "node_modules/@angular/http/bundles/http.umd.js", ... "*": "node_modules/*", "ngx-bootstrap": "node_modules/ngx-bootstrap", "highcharts": "node_modules/highcharts/highcharts.js",

How to use moment-timezone in Angular2 via SystemJs

我是研究僧i 提交于 2019-12-10 14:44:20
问题 I'm using Angular2 via angular2-seed (which uses SystemJS) and trying to load moment-timezone and use moment.tz.guess() specifically. I import via: import * as moment from 'moment-timezone'; When I do this I get the following error in my browser: GET /node_modules/moment-timezone/data/packed/latest.json.js 404 (Not Found) anuglar2-seed uses defaultJSExtensions which I think is why the incorrect .js is being added, so I figured I could just turn this off for moment-timezone in tools/config

System js syntax error, IE11

為{幸葍}努か 提交于 2019-12-10 12:55:22
问题 I've got an angular 2 app working inside firefox and chrome, not so much inside (sigh) IE. Based on my stack trace, it looks like there is a problem with my System js setup. Here is the error description that I see inside my web console. Error: (SystemJS) Syntax error SyntaxError: Syntax error at ZoneDelegate.prototype.invoke (http://localhost:8050/node_modules/zone.js/dist/zone.js:230:13) at Zone.prototype.run (http://localhost:8050/node_modules/zone.js/dist/zone.js:114:17) at Anonymous

How to export a TypeScript module for SystemJS?

梦想的初衷 提交于 2019-12-10 10:20:09
问题 On my website I want to import a FancyModule using SystemJS, so that I can create instances of classes which this module exports. So what I want to achieve is this (within a ECMAScript 2015-compatible website): SystemJS.import('MyFancyModule').then(function(MyFancyModule) { var myFancyInstance = new MyFancyModule.MyFancyClass('Test'); console.log(myFancyInstance.text); }); Unfortunately, I am getting the following error: TypeError: MyFancyModule.MyFancyClass is not a constructor(…) Here is my

Angular2 Rxjs 404 error

倖福魔咒の 提交于 2019-12-10 05:10:11
问题 I have the following error when trying to start my Angular2 application: Failed to load resource: the server responded with a status of 404 (Not Found) angular2-polyfills.js:332 Error: Error: XHR error (404 Not Found) loading http://localhost:55707/rxjs(…) Here is my index.html: <!DOCTYPE html> <html> <head> <base href="/"> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Streak Maker</title> <link rel="icon" type="image/png" href="

Using SystemJS/jspm to load async, es5 modules in production

倖福魔咒の 提交于 2019-12-10 02:26:34
问题 I want to be able to asynchronously load dependencies using System.import() , but without having to transpile ES6 to ES5 during production runtime. I want these modules to be transpiled into separate, ES5 modules that are fetched only when needed. I don't want them to be a part of the main bundle. Dev Workflow The modules are effectively loading during my production build which is actually worrisome because I don't want to include any dependencies that allow for transpilation. I have a

Load node module with SystemJS and Karma in Angular 2

假如想象 提交于 2019-12-10 02:12:17
问题 I'm building a web app using Angular 2, SystemJS, and Karma for tests. I'm trying to load the node module ngrx/store in a test: import { it, describe, expect, beforeEach, inject } from 'angular2/testing'; import { Store } from '@ngrx/store'; describe('Graphs store', () => { let graphs; beforeEach(inject([Store], (store: Store<any>) => { graphs = store.select('graphs'); })); it('works', () => { // expect graphs to do something... }); }); However, my tests fail with the following message: 404: