Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for multiple inlined modules #18355

Merged
merged 1 commit into from May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
};