@unpackjs/plugin-react 3.2.3 → 3.2.4

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/dist/index.cjs CHANGED
@@ -102,7 +102,7 @@ import '${(0, core_namespaceObject.getPathInJs)(external_node_path_default().res
102
102
  ],
103
103
  ...pageConfig1,
104
104
  templateParameters: {
105
- mountId: unpackConfig.html?.mountId,
105
+ mountId: unpackConfig.html?.mountId || '',
106
106
  title: (0, core_namespaceObject.isFunction)(unpackConfig.html?.title) ? unpackConfig.html?.title({
107
107
  entryName
108
108
  }) : unpackConfig.html?.title || '',
@@ -137,7 +137,9 @@ ${renderer}
137
137
  plugins: html1.map((h)=>new core_namespaceObject.rspack.HtmlRspackPlugin(h))
138
138
  });
139
139
  }, applySplitChunksConfig = ({ config })=>{
140
- let currentConfig = config.optimization.splitChunks, extraGroups = {};
140
+ let currentSplitChunks = config.optimization?.splitChunks;
141
+ if (!currentSplitChunks) return config;
142
+ let extraGroups = {};
141
143
  return extraGroups.react = {
142
144
  name: 'lib-react',
143
145
  test: (0, core_namespaceObject.isDevServer)() ? /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/,
@@ -147,10 +149,10 @@ ${renderer}
147
149
  test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
148
150
  priority: 0
149
151
  }, config.optimization.splitChunks = {
150
- ...currentConfig,
152
+ ...currentSplitChunks,
151
153
  cacheGroups: {
152
154
  ...extraGroups,
153
- ...currentConfig.cacheGroups
155
+ ...currentSplitChunks.cacheGroups ?? {}
154
156
  }
155
157
  }, config;
156
158
  }, PLUGIN_NAME = 'unpack:react', pluginReact = (options = {})=>{
package/dist/index.js CHANGED
@@ -83,7 +83,7 @@ import '${getPathInJs(node_path.resolve(Object.values(config.entry)[0]))}'
83
83
  ],
84
84
  ...pageConfig1,
85
85
  templateParameters: {
86
- mountId: unpackConfig.html?.mountId,
86
+ mountId: unpackConfig.html?.mountId || '',
87
87
  title: isFunction(unpackConfig.html?.title) ? unpackConfig.html?.title({
88
88
  entryName
89
89
  }) : unpackConfig.html?.title || '',
@@ -124,7 +124,9 @@ ${renderer}
124
124
  config,
125
125
  unpackConfig
126
126
  })), unpackConfig.performance?.chunkSplit?.strategy === 'split-by-experience' && (config = (({ config })=>{
127
- let currentConfig = config.optimization.splitChunks, extraGroups = {};
127
+ let currentSplitChunks = config.optimization?.splitChunks;
128
+ if (!currentSplitChunks) return config;
129
+ let extraGroups = {};
128
130
  return extraGroups.react = {
129
131
  name: 'lib-react',
130
132
  test: isDevServer() ? /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/,
@@ -134,10 +136,10 @@ ${renderer}
134
136
  test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
135
137
  priority: 0
136
138
  }, config.optimization.splitChunks = {
137
- ...currentConfig,
139
+ ...currentSplitChunks,
138
140
  cacheGroups: {
139
141
  ...extraGroups,
140
- ...currentConfig.cacheGroups
142
+ ...currentSplitChunks.cacheGroups ?? {}
141
143
  }
142
144
  }, config;
143
145
  })({
@@ -1 +1 @@
1
- {"version":3,"file":"mpa.d.ts","sourceRoot":"","sources":["../src/mpa.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,oBAAoB,EAYzB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAYvB,eAAO,MAAM,cAAc,GAAI,2BAG5B;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,oBA4GH,CAAA"}
1
+ {"version":3,"file":"mpa.d.ts","sourceRoot":"","sources":["../src/mpa.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,oBAAoB,EAYzB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAYvB,eAAO,MAAM,cAAc,GAAI,2BAG5B;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,oBA2GH,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"splitChunks.d.ts","sourceRoot":"","sources":["../src/splitChunks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAiC,MAAM,gBAAgB,CAAA;AAEzF,eAAO,MAAM,sBAAsB,GAAI,YAAY;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,yCAwBlF,CAAA"}
1
+ {"version":3,"file":"splitChunks.d.ts","sourceRoot":"","sources":["../src/splitChunks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAiC,MAAM,gBAAgB,CAAA;AAEzF,eAAO,MAAM,sBAAsB,GAAI,YAAY;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,yCA4BlF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/plugin-react",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "React plugin for Unpack",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,13 +24,13 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@rspack/plugin-react-refresh": "1.5.2",
27
+ "@rspack/plugin-react-refresh": "1.5.3",
28
28
  "@svgr/webpack": "8.1.0",
29
29
  "@swc/helpers": "0.5.17",
30
30
  "react-refresh": "0.18.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@unpackjs/core": "3.3.5"
33
+ "@unpackjs/core": "3.5.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@unpackjs/core": "3.x"