Skip to content

Commit c1d912a

Browse files
authored
fix ModuleLocalePlugin runtime chunk detection
1 parent 206b1dc commit c1d912a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lastui/rocker",
3-
"version": "0.20.32",
3+
"version": "0.20.33",
44
"license": "Apache-2.0",
55
"author": "[email protected]",
66
"homepage": "https://github.com/lastui/rocker#readme",

webpack/config/module/development.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = merge(require("../../internal/base.js"), require("../../interna
3030
},
3131
output: {
3232
filename(pathData) {
33-
return pathData.chunk.name === settings.BUILD_ID ? "[name].js" : "[name]/main.js";
33+
return pathData.chunk.id === pathData.chunk.runtime ? "[name].js" : "[name]/main.js";
3434
},
3535
},
3636
optimization: {

webpack/plugins/ModuleLocalesPlugin.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class ModuleLocalesPlugin {
3434
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
3535
},
3636
async (_assets) => {
37-
const assetOutputDirectory = path.dirname(compilation.outputOptions.filename);
38-
3937
const assetsToWatch = [];
4038

4139
for (const entryPoint of compilation.entrypoints.values()) {
@@ -68,6 +66,12 @@ class ModuleLocalesPlugin {
6866
continue;
6967
}
7068

69+
const assetOutputDirectory = path.dirname(
70+
typeof compilation.outputOptions.filename === "function"
71+
? compilation.outputOptions.filename({ chunk })
72+
: compilation.outputOptions.filename,
73+
);
74+
7175
for (const asset of this.paths_to_watch) {
7276
const outputDir = assetOutputDirectory.replace(/\[(name|id)\]/g, chunk.id);
7377

0 commit comments

Comments
 (0)