Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit 4634fc4

Browse files
committed
include dynamic import syntax support
1 parent 488a182 commit 4634fc4

8 files changed

Lines changed: 12 additions & 13 deletions

File tree

build-babel/jspm.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ SystemJS.config({
1717
"github:*/*.json"
1818
],
1919
map: {
20+
"babel-plugin-syntax-dynamic-import": "npm:babel-plugin-syntax-dynamic-import@6.18.0",
2021
"debug": "npm:debug@2.6.0",
2122
"babel-core": "npm:babel-core@6.21.0",
2223
"constants": "npm:jspm-nodelibs-constants@0.2.0",

build-babel/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"babel-helpers": "npm:babel-helpers@^6.3.13",
77
"babel-plugin-check-es2015-constants": "npm:babel-plugin-check-es2015-constants@^6.3.13",
88
"babel-plugin-external-helpers": "npm:babel-plugin-external-helpers@^6.3.13",
9+
"babel-plugin-syntax-dynamic-import": "npm:babel-plugin-syntax-dynamic-import@^6.18.0",
910
"babel-plugin-transform-es2015-arrow-functions": "npm:babel-plugin-transform-es2015-arrow-functions@^6.3.13",
1011
"babel-plugin-transform-es2015-block-scoped-functions": "npm:babel-plugin-transform-es2015-block-scoped-functions@^6.3.13",
1112
"babel-plugin-transform-es2015-block-scoping": "npm:babel-plugin-transform-es2015-block-scoping@^6.3.13",

build-babel/systemjs-babel.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import * as babel from 'babel';
22
export { babel };
33

4+
import dynamicImportSyntax from 'babel-plugin-syntax-dynamic-import';
45
import modulesRegisterPlugin from 'babel-plugin-transform-es2015-modules-systemjs';
56
export let modulesRegister = {
6-
plugins: [modulesRegisterPlugin]
7+
plugins: [dynamicImportSyntax, modulesRegisterPlugin]
78
};
89

910
import externalHelpersPlugin from 'babel-plugin-external-helpers';
@@ -66,9 +67,9 @@ let es2015Plugins = [
6667
let regeneratorPlugin = [regenerator, { async: false, asyncGenerators: false }];
6768

6869
export let presetES2015 = {
69-
plugins: [...es2015Plugins, regeneratorPlugin]
70+
plugins: [dynamicImportSyntax, ...es2015Plugins, regeneratorPlugin]
7071
};
7172

7273
export let presetES2015Register = {
73-
plugins: [...es2015Plugins, modulesRegisterPlugin, regeneratorPlugin]
74-
};
74+
plugins: [dynamicImportSyntax, ...es2015Plugins, modulesRegisterPlugin, regeneratorPlugin]
75+
};

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test('systemjs-plugin-babel', function (t) {
2121
// then
2222
.then(function(m) {
2323
return m.p().then(function (message) {
24-
t.equal(message, 'Rocks :)');
24+
t.equal(message, 5);
2525
});
2626
})
2727
.then(t.end, t.end);

test/manual.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
},
99
transpiler: 'plugin-babel'
1010
});
11-
System.import('./manual.js').then(console.log.bind(console));
12-
</script>
11+
System.import('./testing-code.js').then(m => m.p()).then(console.log.bind(console));
12+
</script>

test/manual.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/testing-code.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
export async function p() {
2-
return await new Promise(function(resolve, reject) {
3-
setTimeout(function() {
4-
resolve('Rocks :)');
5-
}, 0);
6-
});
2+
return (await import('./testing-dep.js')).p;
73
}

test/testing-dep.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export var p = 5;

0 commit comments

Comments
 (0)