From 21072606249bf6f2bd48436184c5d46492322600 Mon Sep 17 00:00:00 2001 From: wener Date: Fri, 23 Sep 2022 00:08:45 +0800 Subject: [PATCH] avoid module-types override shouldFetch --- src/extras/module-types.js | 3 ++- test/system-node.mjs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/extras/module-types.js b/src/extras/module-types.js index 69daaa0bc..3f429aa6a 100644 --- a/src/extras/module-types.js +++ b/src/extras/module-types.js @@ -8,8 +8,9 @@ import { resolveUrl } from '../common.js'; var systemJSPrototype = global.System.constructor.prototype; var moduleTypesRegEx = /^[^#?]+\.(css|html|json|wasm)([?#].*)?$/; + var _shouldFetch = systemJSPrototype.shouldFetch.bind(systemJSPrototype) systemJSPrototype.shouldFetch = function (url) { - return moduleTypesRegEx.test(url); + return _shouldFetch(url) || moduleTypesRegEx.test(url); }; var jsonContentType = /^application\/json(;|$)/; diff --git a/test/system-node.mjs b/test/system-node.mjs index 3d505d37d..2e3f881cf 100644 --- a/test/system-node.mjs +++ b/test/system-node.mjs @@ -37,7 +37,7 @@ describe('NodeJS version of SystemJS', () => { describe('import maps', () => { it('can load a module from the network', async () => { - applyImportMap(System, {imports: {"rxjs": "https://unpkg.com/@esm-bundle/rxjs@6.5.4-fix.0/system/rxjs.min.js"}}); + applyImportMap(System, {imports: {"rxjs": "https://cdn.jsdelivr.net/npm/@esm-bundle/rxjs@6.5.4-fix.0/system/rxjs.min.js"}}); const rxjs = await System.import("rxjs"); assert.ok(rxjs.Observable); }); @@ -48,4 +48,4 @@ describe('NodeJS version of SystemJS', () => { assert.equal(foo.p, 5); }); }); -}); \ No newline at end of file +});