systemjs

Error importing external angular module at runtime

早过忘川 提交于 2019-12-07 12:16:27
问题 I have been trying to dynamically load an external angular module (AppA) into another angular application (AppB) at runtime. AppA is created with angular-cli, compiled with ngc and packaged with rollupjs. Perfect. I have two cases: AppB completely configured with SystemJS. It can load AppA using System.import instruction without problems. AppB created with angular-cli. There has not been a way to make it work. In the second case, I have two subcases: I tried to import on this way but it does

SystemJS: Correct System.import with bundle-file

故事扮演 提交于 2019-12-07 09:18:32
问题 My bundle out.js file concatenates a main.js and an app.component.js module. Now I want to import this out.js file in my index.html with SystemJS. Actually I want to "call" the main(.js)-module in it. I am now wondering how to import the inner module of my bundle file. Is it the right way to nest a System.import (of inner module) in an outer System.import (of bundle)? Actually it is working but I'm not sure if this is fine. index.html <script type="text/javascript" src="lib/out.js"></script>

Import a shared service that lives outside the app folder in an angular 2 app in typescript using systemjs

China☆狼群 提交于 2019-12-07 06:30:28
问题 I have two angular 2 apps in the following structure: /app /app1 /app2 /shared Inside my angular 2 components (written in typescript), I'm importing several modules (that reside in the same folder) without any issues: import { TestService1 } from './test1.service'; However, when I tried to import something from the shared folder, it was unable to load the required module at runtime (browser). import { TestService2 } from '../shared/test2.service'; The browser says: http://something.something

Importing node modules with electron and Systemjs

a 夏天 提交于 2019-12-07 04:51:23
问题 I just wondered if it is possible to make systemjs use require("remote").require("nodemodule"), if system js can't find the module in its own registry? I think something like this mechanism is already working when using electron with typescript and commonjs modules... Has someone already solved that struggle? 回答1: Finally after some time I found a working solution: var node_modules = ["child_process","fs"]; var fetch = System.fetch; window.remote=require("remote"); System.fetch = function ()

TypeScript+SystemJS using JSON and Text plugins

别说谁变了你拦得住时间么 提交于 2019-12-07 00:36:08
问题 Using TypeScript with SystemJS , how can I import a JSON file using plugin-json ? If I write System.import('myjson.json!json').then(...) then it imports it asynchronously and not as a part of System.register([...]) . So, how can I import a JSON file as a part of System.register([...]) and convincing TypeScript to agree to this? (without then Promise syntax). Note: I'm using the tsc flag -m system Update: A possible solution is to use the -m umd option for tsc instead of -m system , then I can

Options for importing modules in Angular2 (TS)

南笙酒味 提交于 2019-12-07 00:22:39
问题 I know there's some progress or at least plans (#5093, #5728) to improve typescript's module paths mapping, but I was wondering what are our options at this moment (Angular2 beta.1, TypeScript 1.7, VS Code 0.10.5, nodejs 5.4, systemjs 0.19). In order to make everyone happy (compiler, editor and browser) I'm using following syntax to import modules: // C:/~somepath~/project_name/src/scripts/app/components/search/search.component.ts import {Component} from 'angular2/core'; import

How can I configure the jsdom instance used by jest?

自闭症网瘾萝莉.ら 提交于 2019-12-07 00:06:09
问题 I've come up against this issue Invalid URL is thrown when requiring systemjs in jest test cases One of the last comments suggests "manipulate the jsdom instance to have a valid location / baseURI by setting the referrer config in jsdom." I'm wondering is there way for me to do that? Can I access the jsdom instance somehow from the jest object? 回答1: I had a similar issue when using a project requiring a url (location.href). You can configure jest with a testURL in your configuration. Here is

How to disable CSS imports in JSPM / SystemJS

拈花ヽ惹草 提交于 2019-12-06 16:54:03
My issue is JSPM / SystemJS manually inserting CSS dependencies (namely Angular Material's CSS) when I have a different pipeline for those (Gulp + SASS). How can I tell JSPM to not import CSS files or interpret CSS dependencies in any way? I found only this discussion - https://github.com/jspm/jspm-cli/issues/791 - but it did not help me at all. Seems that JSPM prefers local package overrides rather than turning off CSS features completely. The culprit of my original issue is Angular Material's package.json , which contains the following JSPM configuration: "shim": { "angular-material": {

Importing visionmedia debug in Angular 2 app with System.js and how to log messages?

北城余情 提交于 2019-12-06 16:17:29
I am working on a MEAN stack app with Angular 2 frontend. I have successfully used debug in the express app. However I am unable to cleanly import debug in app.components.ts or main.module.ts . Any idea on how to proceed? <script src="/node_modules/debug/debug.js"></script> Results in error: Uncaught ReferenceError: module is not defined <script>System.import('./node_modules/debug/debug.js');</script> Not good either: zone.js:101 GET http://localhost:8002/ms.js 404 (Not Found) Some dependency script not able to load. import { debug } from '../../../node_modules/debug/debug.js'; inside any app

localhost:3000/traceur SystemJS with AngularFire

余生长醉 提交于 2019-12-06 14:50:33
I picked the getting started with Angular2 tutorial format and only added in the angularfire2 part. I installed firebase and angularfire2 using the steps on the angularfire2 docs page Below is my systemjs.config.js /** * System configuration for Angular 2 samples * Adjust as necessary for your application needs. */ (function (global) { System.config({ paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { // our app is within the app folder app: 'app', // angular bundles '@angular/core': 'npm:@angular/core/bundles/core.umd.js'