Comments (12)
I use this in my app:
Promise.all([
System.import('module1'),
System.import('module2')
])
.then(function(modules) { ... })
Alternatively:
function multiImport(modules) {
return Promise.all(modules.map(function(m) { return System.import(m) }))
}
from systemjs.
+1 @guybedford @robdodson Array support for System.import would be convenient when combining SystemJS and Web Components.
from systemjs.
https://groups.google.com/forum/#!topic/jspm-io/rQd_XT_ZetU
from systemjs.
Yes, this is supported, but it is undocumented as I'm still not sure if the Loader specification will allow this or not.
Even if not in the spec though, I would still add it to jspm. But it then just depends how possible that is.
from systemjs.
Thank you guys, worked like a charm!
May I ask how much work it would be to remove the functionality for npm, github and cdnJS? As for an internal web application I can't anyway rely on them so I'd rather save the few KB's if possible.
from systemjs.
The endpoints are simply this line here - https://github.com/jspm/jspm-loader/blob/master/loader.js#L811
It's just a default. There is really nothing to remove.
You may want to set a custom registryURL as well.
Any further questions just ask.
from systemjs.
@guybedford is this still supported? I was looking to do the same thing this weekend but wasn't sure how to make the jspm object available on my page
from systemjs.
@MajorBreakfast yeah I wrote something similar, was just curious if there is some way to not have to do all the boilerplate myself. I think (but I may be mistaken) that System usually wants there to just be 1 call to import (like for a main.js file) and so maybe this is outside normal usage. @guybedford is that accurate?
from systemjs.
@robdodson I don't know of any plans for an array require, but it could be worth bringing up as a spec issue. I do like the perspective of having a single entry point though, as you then need all dynamic calls to be full modules themselves, which works well with bundling. We will have <script type="module">
to make the inline case easier anyway in future.
from systemjs.
@guybedford yeah I'm specifically looking at it from the case of Web Components where it's harder to have one entry point if you're using HTML Imports. I'm not a fan of the current approach in ModuleLoader/es-module-loader#95 with htmlimport-esmodule, I'd love to just System.import whatever I need in my script tags vs having to include an HTML Import and then an import statement which references the url for the import. That approach just feels cumbersome to me.
from systemjs.
@robdodson Erik's proposal is out of date, I've updated ModuleLoader/es-module-loader#95 to reflect the latest information. It's worth thinking in terms of module tags first, then working backwards to System.import.
from systemjs.
I tried to use it this way:
System.import(['dexie', 'proteus'])
.then(function(dexie, proteus) {
console.log('dexie', dexie);
console.log('proteus', proteus);
});
But all I'm getting is:
system.src.js:1226 Uncaught (in promise) TypeError: e.match is not a function(…)
from systemjs.
Related Issues (20)
- Uncaught (in promise) TypeError: r[1] is not a function HOT 1
- system.import() is deprecated and will be removed soon. use import() instead HOT 1
- System.import() is deprecated and will be removed soon. Use import() instead. HOT 1
- Cannot make React 18 (production, UMD) work with SystemJS HOT 4
- Can the latest version 6.13.0 completely replace version 0.21?
- Provide explanation on script load performance overhead
- Sending Authorization header HOT 2
- How to use system js with Angular 14 and typescript HOT 1
- fetch-load.js is not ES5 compatible in 6.14.0 HOT 3
- Where I can see example how to use systemjs with new angular version (14 or 15)
- import with npm
- How to register a module by API HOT 3
- systemjs load css suport url(image/test.svg) without quotes in url
- setupProxy.js file not working in single-spa-react
- Apply CSS from nested dependency HOT 2
- worker-load.js conflicts with fetch-load.js and prevents systemjs-babel from working in a web worker
- Updating systemjs from 0.21.5 to latest (6.14.1)
- lastScript detection doesn't seem to be 100% reliable HOT 3
- [NodeJS] Should System.import('my-module') refetch if called twice? HOT 2
- Multiple dependencies bundled in one file (previously "bundles" config option)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from systemjs.