@lynx-js/react-webpack-plugin-canary 0.11.3 → 0.11.4-canary-20260907-c044a0b8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/ReactWebpackPlugin.js +21 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lynx-js/react-webpack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.11.4-canary-20260907033415-c044a0b8c581658ed75611503b72d0fbfad3cd7e
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Encode the element templates of a lazy bundle into that lazy bundle. Its chunk groups come from dynamic imports and have no name, so looking them up in `compilation.namedChunkGroups` found nothing and every Element Template lazy bundle shipped without its templates: the main thread could not create them, the lazy component never rendered, and a development build reported `No BehaviorController defined for class template`. ([#3819](https://github.com/lynx-family/lynx-stack/pull/3819))
|
|
8
|
+
|
|
3
9
|
## 0.11.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -81,13 +81,29 @@ export function mergeElementTemplatesFromModule(elementTemplates, module) {
|
|
|
81
81
|
* @internal
|
|
82
82
|
*/
|
|
83
83
|
export function collectElementTemplatesForEntries(entryNames, getChunkGroup, getChunkModules) {
|
|
84
|
-
const
|
|
85
|
-
const visited = new Set();
|
|
84
|
+
const chunkGroups = [];
|
|
86
85
|
for (const entryName of entryNames) {
|
|
87
86
|
const chunkGroup = getChunkGroup(entryName);
|
|
88
|
-
if (chunkGroup
|
|
89
|
-
|
|
87
|
+
if (chunkGroup !== undefined) {
|
|
88
|
+
chunkGroups.push(chunkGroup);
|
|
90
89
|
}
|
|
90
|
+
}
|
|
91
|
+
return collectElementTemplatesForChunkGroups(chunkGroups, getChunkModules);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Collect element templates for the chunk groups an encoded bundle covers.
|
|
95
|
+
*
|
|
96
|
+
* A lazy bundle's chunk groups come from dynamic imports and have no name, so
|
|
97
|
+
* they have to be walked directly rather than looked up in
|
|
98
|
+
* `compilation.namedChunkGroups`; otherwise the lazy bundle is encoded without
|
|
99
|
+
* its templates and the main thread cannot create them.
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
export function collectElementTemplatesForChunkGroups(chunkGroups, getChunkModules) {
|
|
104
|
+
const elementTemplates = {};
|
|
105
|
+
const visited = new Set();
|
|
106
|
+
for (const chunkGroup of chunkGroups) {
|
|
91
107
|
for (const chunk of chunkGroup.chunks) {
|
|
92
108
|
for (const module of getChunkModules(chunk)) {
|
|
93
109
|
if (visited.has(module)) {
|
|
@@ -333,7 +349,7 @@ class ReactWebpackPlugin {
|
|
|
333
349
|
if (options.experimental_useElementTemplate) {
|
|
334
350
|
hooks.beforeEncode.tap(`${this.constructor.name}.ElementTemplate`, (args) => {
|
|
335
351
|
const { chunkGraph } = compilation;
|
|
336
|
-
const elementTemplates =
|
|
352
|
+
const elementTemplates = collectElementTemplatesForChunkGroups(args.chunkGroups, (chunk) => chunkGraph.getChunkModules(chunk));
|
|
337
353
|
args.encodeData.sourceContent.config['enableUnifyFixedBehavior'] =
|
|
338
354
|
true;
|
|
339
355
|
args.encodeData.elementTemplate = elementTemplates;
|