@lynx-js/react-webpack-plugin-canary 0.11.2 → 0.11.3-canary-20260905-7d3a2d24

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lynx-js/react-webpack-plugin
2
2
 
3
+ ## 0.11.3-canary-20260905085050-7d3a2d2430ffecf7109855f273dbd58013f907c7
4
+
5
+ ### Patch Changes
6
+
7
+ - Keep the lazy-chunk definitions import of one compiler from leaking into another compiler in the same process, which made builds with several environments fail intermittently with `Module not found: Can't resolve '<lazy module>.__lynx-react-defines.js'`. ([#3817](https://github.com/lynx-family/lynx-stack/pull/3817))
8
+
3
9
  ## 0.11.2
4
10
 
5
11
  ### Patch Changes
@@ -11,7 +11,8 @@ export function applyDefinesInjection(compiler, entryPairs, pluginName) {
11
11
  virtualModules.apply(compiler);
12
12
  compiler.hooks.finishMake.tapPromise(pluginName, async (compilation) => {
13
13
  const { moduleGraph } = compilation;
14
- definesImportByBoundary.clear();
14
+ const definesImports = definesImportByBoundary(compiler);
15
+ definesImports.clear();
15
16
  const traverse = (roots) => {
16
17
  const visited = new Set();
17
18
  const asyncBoundaries = new Map();
@@ -90,7 +91,7 @@ export function applyDefinesInjection(compiler, entryPairs, pluginName) {
90
91
  continue;
91
92
  }
92
93
  await processScope([backgroundBoundary], [mainThreadBoundary], present, `${resource}.__lynx-react-defines.js`, async (boundaryRequest) => {
93
- definesImportByBoundary.set(boundaryKey(mainThreadBoundary.layer, resource), boundaryRequest);
94
+ definesImports.set(boundaryKey(mainThreadBoundary.layer, resource), boundaryRequest);
94
95
  await rebuildModule(mainThreadBoundary);
95
96
  });
96
97
  }
@@ -1,2 +1,2 @@
1
1
  export declare function boundaryKey(layer: string | null | undefined, resourcePath: string): string;
2
- export declare const definesImportByBoundary: Map<string, string>;
2
+ export declare function definesImportByBoundary(compiler: object): Map<string, string>;
@@ -4,5 +4,16 @@
4
4
  export function boundaryKey(layer, resourcePath) {
5
5
  return `${layer ?? ''}|${resourcePath}`;
6
6
  }
7
- export const definesImportByBoundary = new Map();
7
+ // Keyed by compiler: rsbuild compiles every environment in one process, and a
8
+ // boundary recorded by one compiler must not make another compiler's loader
9
+ // import a virtual module that only exists in the first compiler.
10
+ const definesImportsByCompiler = new WeakMap();
11
+ export function definesImportByBoundary(compiler) {
12
+ let imports = definesImportsByCompiler.get(compiler);
13
+ if (!imports) {
14
+ imports = new Map();
15
+ definesImportsByCompiler.set(compiler, imports);
16
+ }
17
+ return imports;
18
+ }
8
19
  //# sourceMappingURL=defines-import-by-boundary.js.map
@@ -96,7 +96,9 @@ const mainThreadLoader = function (content, sourceMap) {
96
96
  buildInfo[DEFINES_FOR_WORKLET_BUILD_INFO] = result.definesForWorklet;
97
97
  }
98
98
  }
99
- const definesImport = definesImportByBoundary.get(boundaryKey(currentModule?.layer, this.resourcePath));
99
+ const definesImport = this._compiler
100
+ ? definesImportByBoundary(this._compiler).get(boundaryKey(currentModule?.layer, this.resourcePath))
101
+ : undefined;
100
102
  this.callback(null, result.code
101
103
  + (definesImport ? `\nimport ${JSON.stringify(definesImport)};` : '')
102
104
  + (this.hot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-webpack-plugin-canary",
3
- "version": "0.11.2",
3
+ "version": "0.11.3-canary-20260905-7d3a2d24",
4
4
  "description": "A webpack plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "webpack",
@@ -45,8 +45,8 @@
45
45
  "css-loader": "^7.1.4",
46
46
  "swc-loader": "^0.2.7",
47
47
  "@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.16.0",
48
- "@lynx-js/test-tools": "0.0.0",
49
48
  "@lynx-js/react": "npm:@lynx-js/react-canary@0.126.0",
49
+ "@lynx-js/test-tools": "0.0.0",
50
50
  "@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.11.0"
51
51
  },
52
52
  "peerDependencies": {