systemjs

How to load named exports with SystemJS

喜夏-厌秋 提交于 2019-12-23 20:53:04
问题 If I have a lib, say utils.js which looks like this exports.foo = function () { return 'foo'; }; exports.bar = function () { return 'bar'; }; Which can be used as follows import {foo} from './libs/utils'; console.log(foo()); Not very spectacular, but I get the feeling that this problem is the origin of the issue described in this post. Anyway I cannot get this to work in combination with SystemJS. I have to change the code to fix it import utils from './libs/utils'; console.log(utils.foo());

Randomly failing polymer web component test

不想你离开。 提交于 2019-12-23 15:36:10
问题 Yet another attempt to marry Polymer with ES6 classes. And it almost works except a wct test failing randomly on a polymer component with an imported es6 class (by systemjs). As far as I understand, this happens because the script, containing class definition, gets loaded after mocha executed the test. The polymer component consists of two parts - html and javascript (to compile latter to es5), html: <dom-module id="my-test"> <template>hello</template> <script> System.import('elements/my-test

How do I shim a non CommonJS, non AMD package which depends on global jQuery & lodash?

三世轮回 提交于 2019-12-23 12:39:05
问题 I am using jspm for the first time and already ran into a snag. I need to figure out how to "shim" a proprietary script which lives on our company's private npm registry. Package: widget Resides on private npm registry Is not a CommonJS, UMD/AMD module Depends on lodash and jquery , but assumes they exist on global scope Exposes Widget on the global scope Here's the (hypothetical) code var Widget = { render: function(el, symbol) { symbol = _.trim(symbol); $(el).text(symbol); } }; app.js var

How to add a module to my SystemJs config file so I can import it in angular

风流意气都作罢 提交于 2019-12-23 12:34:19
问题 How do add new packages I just downloaded from npm to my Angular 2 components using SystemJS and using this system.config.js file. The code bellow was generated for me by a starter package. I have tried to put links to the modules in the map and packages section of this file but it doesn't seem to work. All I want to know is how can I take a library such as underscore js located in my node_modules and input it into this file so I can easily import the file in my typescript angular components.

ES6 async modules using multiple baseurls

梦想的初衷 提交于 2019-12-22 10:23:54
问题 The ES6 module system seems to be a proper fit for unifying the CommonJs / AMD syntaxes. As a requireJs/AMD-user I'd like to convert to ES6 modules (using babel.js for now). There seems to be one problem though; reading through the docs and tutorials, there doesn't seem to be possible to load module packages that are dependendent on more than one baseurl. Using requireJs this is solvable using the context field: // async dependencies are loaded from http://path/to/domain var contextedRequire1

Best module loader for angular 2? [closed]

百般思念 提交于 2019-12-22 08:46:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I have went through couple of module loaders for JavaScript & Angular JS 1 AMD, requireJS, Browserify, JSPM, Webpack, SystemJS, CommonJS. Which one is the best module loader to use with angular 2 ? 回答1: Just like in angularJs, it doesn't really matter which loader you want to use for angular2. Whatever worked

Including Concatenated Typescript JS outFile - Angular 2 + Typescript

那年仲夏 提交于 2019-12-22 08:41:01
问题 I've got the following code: index.html <script src="node_modules/systemjs/dist/system-polyfills.js"></script> <script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script> <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="node_modules/rxjs/bundles/Rx.js"></script> <script src="node_modules/angular2/bundles/angular2.dev.js"></script> <script src="node_modules/angular2

Using SystemJS and Webpack

不问归期 提交于 2019-12-22 07:55:08
问题 I have a solution built with Angular + Typescript + Webpack2 and I want to load dynamically some external modules that are known only at runtime. Since I can't use webpack to accomplish this task I'm exploring SystemJs. I was trying to require SystemJS but this causes the application to fail, as the execution flow hit let System = require('systemjs'); I get this error Cannot find module "." at webpackMissingModule (system.src.js:3893) [angular] at new SystemJSLoader$1 (system.src.js:3893)

Detect whether Angular is loaded on a page when using Systemjs

血红的双手。 提交于 2019-12-22 06:28:36
问题 UPDATE: This question was specifically talking about Angular 2 , and is now out of date . At the time of posting, there was not a way to detect whether it was loaded on the page. I have not tested other version, but Angular 8 now has an easy way to detect this and has been pointed out in the answer below. I'm trying to figure out a good (preferably the best) way to detect whether or not Angular is loaded on the page. I took a look at this question: Ways to Detect whether AngularJS is loaded

How can I specify library dependencies using SystemJS?

旧巷老猫 提交于 2019-12-22 05:28:16
问题 Using SystemJS, how do I specify that one library depends on another? For example, the Bootstrap JavaScript library depends on jQuery. Based on the SytemJS docs, I assumed I would specify this dependency using System.config.meta property: System.config({ baseUrl: './scripts', defaultJSExtensions: true, map: { jquery: './lib/jquery-2.2.0.min.js', bootstrap: './lib/bootstrap.min.js' }, meta: { bootstrap: { deps: ['jquery'] } } }); System.import('./scripts/app.js'); But this seems to have no