Skip to content

Commit

Permalink
test: add test for multiple inlined modules
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed May 7, 2024
2 parents 3f5a5ab + 7982789 commit a679033
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/configCases/output-module/multiple-inlined-module/index-1.js
@@ -0,0 +1,16 @@
import { value as v1 } from "./module1";
const v2 = require("./module2")

var value = 42;

function inc() {
value++;
}

it("multiple inlined modules should be wrapped in IIFE to isolate from other inlined modules and chunk modules", () => {
expect(value).toBe(42);
expect(v1).toBe(undefined);
expect(v2).toBe(undefined);
inc();
expect(value).toBe(43);
});
@@ -0,0 +1 @@
var value = 42;
@@ -0,0 +1,3 @@
let value;

export { value };
@@ -0,0 +1,3 @@
let value

module.exports = value
@@ -0,0 +1,14 @@
/** @type {import("../../../../").Configuration} */
module.exports = {
entry: ["./index-1.js", "./index-2.js"],
output: {
module: true
},
optimization: {
concatenateModules: true
},
experiments: {
outputModule: true
},
target: "es2020"
};

0 comments on commit a679033

Please sign in to comment.