Skip to content

Commit

Permalink
Patching prepareImport before loading script modules. Resolves #2024.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Sep 12, 2019
1 parent c08c92d commit 0af3e36
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/system.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './features/import-map.js';
import './features/script-load.js';
import './features/worker-load.js';
import './extras/global.js';
import './extras/module-types.js';
import './features/import-map.js';
import './features/registry.js';
6 changes: 6 additions & 0 deletions test/browser/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,10 @@ suite('SystemJS Standard Tests', function() {
assert.ok(System.has(resolved));
assert.equal(System.get(resolved).hello, 'there');
});

test('should load <script type=systemjs-module> that is in the dom before systemjs is loaded', function () {
const resolved = System.resolve('/test/fixtures/browser/systemjs-module-early.js');
assert.ok(System.has(resolved));
assert.equal(System.get(resolved).hi, 'bye');
})
});
7 changes: 7 additions & 0 deletions test/fixtures/browser/systemjs-module-early.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
System.register([], function(_export) {
return {
execute: function () {
_export('hi', 'bye');
}
};
});
1 change: 1 addition & 0 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<script src="../node_modules/mocha/mocha.js"></script>

<script type="systemjs-importmap" src="fixtures/browser/importmap.json"></script>
<script type="systemjs-module" src="/test/fixtures/browser/systemjs-module-early.js"></script>
<script src="../dist/system.js"></script>
<script type="systemjs-module" src="/test/fixtures/browser/systemjs-module-script.js"></script>
<script type="systemjs-module" src="import:/test/fixtures/browser/systemjs-module-script2.js"></script>
Expand Down

0 comments on commit 0af3e36

Please sign in to comment.