@lynx-js/externals-loading-webpack-plugin-canary 0.0.4 → 0.0.5-canary-20260312-39fdf1ab
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 +12 -6
- package/lib/index.js +16 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lynx-js/externals-loading-webpack-plugin
|
|
2
2
|
|
|
3
|
+
## 0.0.5-canary-20260312070447-39fdf1ab9c4a3b82ce2356d5381598cfa668fb55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix snapshot not found error when dev with external bundle ([#2316](https://github.com/lynx-family/lynx-stack/pull/2316))
|
|
8
|
+
|
|
3
9
|
## 0.0.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -28,18 +34,18 @@
|
|
|
28
34
|
|
|
29
35
|
```js
|
|
30
36
|
// webpack.config.js
|
|
31
|
-
import { ExternalsLoadingPlugin } from
|
|
37
|
+
import { ExternalsLoadingPlugin } from "@lynx-js/externals-loading-webpack-plugin";
|
|
32
38
|
|
|
33
39
|
export default {
|
|
34
40
|
plugins: [
|
|
35
41
|
new ExternalsLoadingPlugin({
|
|
36
|
-
mainThreadLayer:
|
|
37
|
-
backgroundLayer:
|
|
42
|
+
mainThreadLayer: "main-thread",
|
|
43
|
+
backgroundLayer: "background",
|
|
38
44
|
externals: {
|
|
39
45
|
lodash: {
|
|
40
|
-
url:
|
|
41
|
-
background: { sectionPath:
|
|
42
|
-
mainThread: { sectionPath:
|
|
46
|
+
url: "http://lodash.lynx.bundle",
|
|
47
|
+
background: { sectionPath: "background" },
|
|
48
|
+
mainThread: { sectionPath: "main-thread" },
|
|
43
49
|
},
|
|
44
50
|
},
|
|
45
51
|
}),
|
package/lib/index.js
CHANGED
|
@@ -93,10 +93,14 @@ function createLoadExternalAsync(handler, sectionPath) {
|
|
|
93
93
|
${isMainThreadLayer
|
|
94
94
|
? `
|
|
95
95
|
// TODO: Use configured layer suffix instead of hard-coded __main-thread for CSS section lookup.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
if (typeof __LoadStyleSheet === 'function') {
|
|
97
|
+
const styleSheet = __LoadStyleSheet(sectionPath.replace('__main-thread', '') + ':CSS', response.url);
|
|
98
|
+
if (styleSheet !== null) {
|
|
99
|
+
__AdoptStyleSheet(styleSheet);
|
|
100
|
+
__FlushElementTree();
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
console.warn('__LoadStyleSheet is not defined. Failed to load CSS for ' + sectionPath + ' in ' + response.url + '. __LoadStyleSheet is only available in LynxSDK >= 3.7');
|
|
100
104
|
}
|
|
101
105
|
`
|
|
102
106
|
: ''}
|
|
@@ -119,10 +123,14 @@ function createLoadExternalSync(handler, sectionPath, timeout) {
|
|
|
119
123
|
${isMainThreadLayer
|
|
120
124
|
? `
|
|
121
125
|
// TODO: Use configured layer suffix instead of hard-coded __main-thread for CSS section lookup.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
if (typeof __LoadStyleSheet === 'function') {
|
|
127
|
+
const styleSheet = __LoadStyleSheet(sectionPath.replace('__main-thread', '') + ':CSS', response.url);
|
|
128
|
+
if (styleSheet !== null) {
|
|
129
|
+
__AdoptStyleSheet(styleSheet);
|
|
130
|
+
__FlushElementTree();
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
console.warn('__LoadStyleSheet is not defined. Failed to load CSS for ' + sectionPath + ' in ' + response.url + '. __LoadStyleSheet is only available in LynxSDK >= 3.7');
|
|
126
134
|
}
|
|
127
135
|
`
|
|
128
136
|
: ''}
|