You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.
//boot.js
var main = require('./main.js')
main.boot()
//main.js
export async function boot() {
await new Promise(function(resolve, reject) {
console.log('hello world');
setTimeout(function() {
resolve();
}, 1000);
})
console.log('hello world after 1s!');
}
This one works with webpack but systemjs:
//boot.js
var main = require('./main.js')
//main.js
(async function boot() {
await new Promise(function(resolve, reject) {
console.log('hello world');
setTimeout(function() {
resolve();
}, 1000);
})
console.log('hello world after 1s!');
})()
Not sure is it an issue
Edit:
Works after adding this: export var p = 5;
More precisely, in configuration:
meta: {
'./js/main.js': {
format: 'esm'
}
}
The text was updated successfully, but these errors were encountered:
@rf00 AFAIK, systemjs classifies a module as an ES6 module only if there are import/export statements. Otherwise it assumes it is ES5 and does not apply the transpiler.
@rf00 AFAIK, systemjs classifies a module as an ES6 module only if there are import/export statements. Otherwise it assumes it is ES5 and does not apply the transpiler.
Sort of. Basically, if there is no out-of-band1 metadata specifying the format of a package, files are parsed and a format is inferred based on a number of factors including the presence of import/export statements.
It is often desirable to specify the source module format declaratively as this may improve performance and does not depend on heuristics2
1 Out of band in this context would be package configuration such as
SystemJS.config({transpiler: "plugin-babel",packages: {"app" : {// The format of modules within this package will not be inferred by parsing// and rather will be assumed to match the specified value"format": "esm","meta": {"*.js" : {"loader": "plugin-babel"}}},// the following are just examples for expository purposes"jquery": {"format": "amd"},"moment": {"format": "cjs"},"rxjs": {"format": "esm",// I am a masochist who wants to build RxJS from source"map": {".": "./src"},"defaultExtension": "ts","meta": {"*.ts": {"loader": "plugin-typescript"}}}}});
It may also come in the form of overrides in the jspm registry
{
"format": "amd"
}
or overrides explicitly provided when installing with jspm on a case by case basis
This one works:
This one works with webpack but systemjs:
Not sure is it an issue
Edit:
Works after adding this:
export var p = 5;
More precisely, in configuration:
The text was updated successfully, but these errors were encountered: