@lynx-js/react-webpack-plugin 0.6.8 → 0.6.10
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,21 @@
|
|
|
1
1
|
# @lynx-js/react-webpack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.6.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add extractStr option to pluginReactLynx ([#391](https://github.com/lynx-family/lynx-stack/pull/391))
|
|
8
|
+
|
|
9
|
+
- Fix issue with lazy loading of bundles when source maps are enabled. ([#380](https://github.com/lynx-family/lynx-stack/pull/380))
|
|
10
|
+
|
|
11
|
+
- Fix issue where loading a lazy bundle fails if it does not return a webpack chunk. ([#365](https://github.com/lynx-family/lynx-stack/pull/365))
|
|
12
|
+
|
|
13
|
+
## 0.6.9
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Support `@lynx-js/react` v0.106.0. ([#239](https://github.com/lynx-family/lynx-stack/pull/239))
|
|
18
|
+
|
|
3
19
|
## 0.6.8
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -12,8 +12,8 @@ export function createLynxProcessEvalResultRuntimeModule(webpack) {
|
|
|
12
12
|
}
|
|
13
13
|
return `
|
|
14
14
|
${LynxRuntimeGlobals.lynxProcessEvalResult} = function (result, schema) {
|
|
15
|
-
var chunk = result(schema);
|
|
16
|
-
if (chunk.ids && chunk.modules) {
|
|
15
|
+
var chunk = result && result(schema);
|
|
16
|
+
if (chunk && chunk.ids && chunk.modules) {
|
|
17
17
|
// We only deal with webpack chunk
|
|
18
18
|
${webpack.RuntimeGlobals.externalInstallChunk}(chunk);
|
|
19
19
|
// TODO: sort with preOrderIndex. See: https://github.com/web-infra-dev/rspack/pull/8588
|
|
@@ -22,6 +22,7 @@ ${LynxRuntimeGlobals.lynxProcessEvalResult} = function (result, schema) {
|
|
|
22
22
|
}
|
|
23
23
|
return chunk;
|
|
24
24
|
}
|
|
25
|
+
return chunk
|
|
25
26
|
}
|
|
26
27
|
`;
|
|
27
28
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import { LAYERS } from './layer.js';
|
|
3
|
+
/**
|
|
4
|
+
* The options for extractStr.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtractStrConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The minimum length of string literals to be extracted.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue `20`
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
strLength: number;
|
|
17
|
+
}
|
|
3
18
|
/**
|
|
4
19
|
* The options for ReactWebpackPlugin
|
|
5
20
|
*
|
|
@@ -14,10 +29,21 @@ interface ReactWebpackPluginOptions {
|
|
|
14
29
|
* {@inheritdoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.firstScreenSyncTiming}
|
|
15
30
|
*/
|
|
16
31
|
firstScreenSyncTiming?: 'immediately' | 'jsReady';
|
|
32
|
+
/**
|
|
33
|
+
* {@inheritdoc @lynx-dev/react-rsbuild-plugin#PluginReactLynxOptions.enableSSR}
|
|
34
|
+
*/
|
|
35
|
+
enableSSR?: boolean;
|
|
17
36
|
/**
|
|
18
37
|
* The chunk names to be considered as main thread chunks.
|
|
19
38
|
*/
|
|
20
39
|
mainThreadChunks?: string[] | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Merge same string literals in JS and Lepus to reduce output bundle size.
|
|
42
|
+
* Set to `false` to disable.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue false
|
|
45
|
+
*/
|
|
46
|
+
extractStr?: Partial<ExtractStrConfig> | boolean;
|
|
21
47
|
/**
|
|
22
48
|
* Whether to enable lazy bundle.
|
|
23
49
|
*
|
|
@@ -73,7 +73,9 @@ class ReactWebpackPlugin {
|
|
|
73
73
|
.freeze({
|
|
74
74
|
disableCreateSelectorQueryIncompatibleWarning: false,
|
|
75
75
|
firstScreenSyncTiming: 'immediately',
|
|
76
|
+
enableSSR: false,
|
|
76
77
|
mainThreadChunks: [],
|
|
78
|
+
extractStr: false,
|
|
77
79
|
experimental_isLazyBundle: false,
|
|
78
80
|
}); }
|
|
79
81
|
/**
|
|
@@ -102,9 +104,9 @@ class ReactWebpackPlugin {
|
|
|
102
104
|
// We enable profile by default in development.
|
|
103
105
|
// It can also be disabled by environment variable `REACT_PROFILE=false`
|
|
104
106
|
__PROFILE__: JSON.stringify(process.env['REACT_PROFILE'] ?? compiler.options.mode === 'development'),
|
|
105
|
-
|
|
106
|
-
__EXTRACT_STR__: JSON.stringify(false),
|
|
107
|
+
__EXTRACT_STR__: JSON.stringify(Boolean(options.extractStr)),
|
|
107
108
|
__FIRST_SCREEN_SYNC_TIMING__: JSON.stringify(options.firstScreenSyncTiming),
|
|
109
|
+
__ENABLE_SSR__: JSON.stringify(options.enableSSR),
|
|
108
110
|
__DISABLE_CREATE_SELECTOR_QUERY_INCOMPATIBLE_WARNING__: JSON.stringify(options.disableCreateSelectorQueryIncompatibleWarning),
|
|
109
111
|
}).apply(compiler);
|
|
110
112
|
compiler.hooks.thisCompilation.tap(this.constructor.name, compilation => {
|
|
@@ -178,8 +180,8 @@ class ReactWebpackPlugin {
|
|
|
178
180
|
(function (globDynamicComponentEntry) {
|
|
179
181
|
const module = { exports: {} }
|
|
180
182
|
const exports = module.exports
|
|
181
|
-
`, old,
|
|
182
|
-
return module.exports
|
|
183
|
+
`, old, `
|
|
184
|
+
;return module.exports
|
|
183
185
|
})`));
|
|
184
186
|
return args;
|
|
185
187
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* A webpack plugin to integrate webpack with ReactLynx.
|
|
5
5
|
*/
|
|
6
6
|
export { ReactWebpackPlugin } from './ReactWebpackPlugin.js';
|
|
7
|
-
export type { ReactWebpackPluginOptions } from './ReactWebpackPlugin.js';
|
|
7
|
+
export type { ReactWebpackPluginOptions, ExtractStrConfig, } from './ReactWebpackPlugin.js';
|
|
8
8
|
export { LAYERS } from './layer.js';
|
|
9
9
|
export type { ReactLoaderOptions } from './loaders/options.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-webpack-plugin",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "A webpack plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@microsoft/api-extractor": "7.51.1",
|
|
41
|
-
"@rspack/core": "1.
|
|
41
|
+
"@rspack/core": "1.3.0-beta.1",
|
|
42
42
|
"css-loader": "^7.1.2",
|
|
43
43
|
"swc-loader": "^0.2.6",
|
|
44
44
|
"webpack": "^5.98.0",
|
|
45
45
|
"@lynx-js/css-extract-webpack-plugin": "0.5.2",
|
|
46
|
-
"@lynx-js/react": "0.
|
|
47
|
-
"@lynx-js/template-webpack-plugin": "0.6.
|
|
46
|
+
"@lynx-js/react": "0.106.2",
|
|
47
|
+
"@lynx-js/template-webpack-plugin": "0.6.7",
|
|
48
48
|
"@lynx-js/test-tools": "0.0.0",
|
|
49
49
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0",
|
|
52
|
+
"@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0",
|
|
53
53
|
"@lynx-js/template-webpack-plugin": "^0.4.0 || ^0.5.0 || ^0.6.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|