Skip to content

Commit 080bb65

Browse files
committed
Fix case where an entrypoint has no localized resources, but async chunks do.
1 parent 5379803 commit 080bb65

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import(/* webpackChunkName: 'chunk-with-strings' */ './chunks/chunkWithStrings').then(({ ChunkWithStringsClass }) => {
2+
const chunk = new ChunkWithStringsClass();
3+
chunk.doStuff();
4+
});

build-tests/localization-plugin-test-03/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = function(env) {
3131
entry: {
3232
'localization-test-A': path.join(__dirname, 'src', 'indexA.ts'),
3333
'localization-test-B': path.join(__dirname, 'src', 'indexB.ts'),
34+
'localization-test-C': path.join(__dirname, 'src', 'indexC.ts')
3435
},
3536
output: {
3637
path: path.join(__dirname, 'dist'),

webpack/localization-plugin/src/LocalizationPlugin.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,13 @@ export class LocalizationPlugin implements Webpack.Plugin {
260260
}
261261

262262
for (const chunk of chunks) {
263-
let chunkHasAnyLocModules: boolean = false;
264-
for (const module of chunk.getModules()) {
265-
if (EntityMarker.getMark(module)) {
266-
chunkHasAnyLocModules = true;
267-
break;
263+
let chunkHasAnyLocModules: boolean = chunk.getAllAsyncChunks().size > 0;
264+
if (!chunkHasAnyLocModules) {
265+
for (const module of chunk.getModules()) {
266+
if (EntityMarker.getMark(module)) {
267+
chunkHasAnyLocModules = true;
268+
break;
269+
}
268270
}
269271
}
270272

0 commit comments

Comments
 (0)