Skip to content

Commit 0474270

Browse files
committed
fix rspack production mode by telling swc that it's a module
1 parent 1567536 commit 0474270

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/scramjet/packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"url": "https://github.com/MercuryWorkshop/scramjet"
1010
},
1111
"scripts": {
12-
"build": "rspack build --mode production",
13-
"build:types": "rslib build && rm -rf dist/temp",
12+
"build": "cd ../.. && rspack build --mode production",
13+
"build:types": "cd ../.. && rslib build && rm -rf packages/core/dist/temp",
1414
"build:all": "npm run build && npm run build:types",
1515
"rewriter:build": "cd rewriter/wasm/ && bash build.sh && cd ../../",
1616
"dev": "node server.js",

packages/scramjet/rspack.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ const createScramjetConfig = (options) => {
130130
/Critical dependency: the request of a dependency is an expression/,
131131
},
132132
],
133+
optimization: {
134+
minimizer: [
135+
new rspack.SwcJsMinimizerRspackPlugin({
136+
minimizerOptions: {
137+
module: output.libraryTarget === "module",
138+
},
139+
}),
140+
],
141+
},
133142
...extraConfig,
134143
});
135144
};

0 commit comments

Comments
 (0)