diff --git a/test/extractLoader.test.js b/test/extractLoader.test.js index 4bad1a9..0f48d4c 100644 --- a/test/extractLoader.test.js +++ b/test/extractLoader.test.js @@ -82,6 +82,28 @@ describe("extractLoader", () => { // ); })); + it("should extract the script.html as file, emit the referenced script and rewrite the url", () => + compile({testModule: "script.html"}).then(() => { + const scriptHtml = path.resolve(__dirname, "dist/script-dist.html"); + const scriptJs = path.resolve(__dirname, "dist/simple-dist.js"); + + expect(scriptHtml).to.be.a.file(); + expect(scriptJs).to.be.a.file(); + expect(scriptHtml).to.have.content.that.match( + / + + diff --git a/test/modules/esm.js b/test/modules/esm.js new file mode 100644 index 0000000..49c6f6a --- /dev/null +++ b/test/modules/esm.js @@ -0,0 +1 @@ +export * from 'btoa' diff --git a/test/modules/script.html b/test/modules/script.html new file mode 100644 index 0000000..11f503b --- /dev/null +++ b/test/modules/script.html @@ -0,0 +1,10 @@ + + + + + Hello World + + + + + diff --git a/test/support/compile.js b/test/support/compile.js index 1322bf9..40740e2 100644 --- a/test/support/compile.js +++ b/test/support/compile.js @@ -53,7 +53,7 @@ function compile({testModule, publicPath, loaderOptions}) { { loader: "html-loader", options: { - attrs: ["img:src", "link:href"], + attrs: ["img:src", "link:href", "script:src"], interpolate: true, }, },