@modern-js/app-tools 2.7.1-alpha.0 → 2.8.0

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.
Files changed (260) hide show
  1. package/CHANGELOG.md +53 -2
  2. package/dist/cjs/analyze/generateCode.js +14 -3
  3. package/dist/cjs/analyze/index.js +0 -45
  4. package/dist/cjs/analyze/templates.js +30 -8
  5. package/dist/cjs/analyze/utils.js +5 -0
  6. package/dist/cjs/builder/index.js +1 -1
  7. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +25 -1
  8. package/dist/esm/analyze/generateCode.js +31 -18
  9. package/dist/esm/analyze/index.js +2 -34
  10. package/dist/esm/analyze/templates.js +21 -8
  11. package/dist/esm/analyze/utils.js +4 -1
  12. package/dist/esm/builder/index.js +1 -1
  13. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +241 -22
  14. package/dist/esm-node/analyze/generateCode.js +19 -4
  15. package/dist/esm-node/analyze/index.js +2 -54
  16. package/dist/esm-node/analyze/templates.js +29 -8
  17. package/dist/esm-node/analyze/utils.js +4 -0
  18. package/dist/esm-node/builder/index.js +1 -1
  19. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +25 -1
  20. package/dist/types/analyze/templates.d.ts +4 -5
  21. package/dist/types/analyze/utils.d.ts +2 -1
  22. package/dist/types/types/config/output.d.ts +0 -1
  23. package/package.json +26 -26
  24. package/dist/js/modern/analyze/constants.js +0 -54
  25. package/dist/js/modern/analyze/generateCode.js +0 -247
  26. package/dist/js/modern/analyze/getBundleEntry.js +0 -71
  27. package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +0 -220
  28. package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +0 -216
  29. package/dist/js/modern/analyze/getClientRoutes/index.js +0 -6
  30. package/dist/js/modern/analyze/getClientRoutes/utils.js +0 -31
  31. package/dist/js/modern/analyze/getFileSystemEntry.js +0 -109
  32. package/dist/js/modern/analyze/getHtmlTemplate.js +0 -115
  33. package/dist/js/modern/analyze/getServerRoutes.js +0 -175
  34. package/dist/js/modern/analyze/index.js +0 -332
  35. package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -42
  36. package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -13
  37. package/dist/js/modern/analyze/nestedRoutes.js +0 -157
  38. package/dist/js/modern/analyze/templates.js +0 -334
  39. package/dist/js/modern/analyze/utils.js +0 -141
  40. package/dist/js/modern/builder/builderPlugins/compatModern.js +0 -233
  41. package/dist/js/modern/builder/index.js +0 -159
  42. package/dist/js/modern/builder/loaders/routerLoader.js +0 -17
  43. package/dist/js/modern/builder/loaders/serverModuleLoader.js +0 -7
  44. package/dist/js/modern/builder/share.js +0 -46
  45. package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -30
  46. package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +0 -37
  47. package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +0 -113
  48. package/dist/js/modern/commands/build.js +0 -91
  49. package/dist/js/modern/commands/deploy.js +0 -28
  50. package/dist/js/modern/commands/dev.js +0 -109
  51. package/dist/js/modern/commands/index.js +0 -3
  52. package/dist/js/modern/commands/inspect.js +0 -38
  53. package/dist/js/modern/commands/serve.js +0 -54
  54. package/dist/js/modern/config/default.js +0 -175
  55. package/dist/js/modern/config/index.js +0 -8
  56. package/dist/js/modern/config/initial/createHtmlConfig.js +0 -35
  57. package/dist/js/modern/config/initial/createOutputConfig.js +0 -68
  58. package/dist/js/modern/config/initial/createSourceConfig.js +0 -39
  59. package/dist/js/modern/config/initial/createToolsConfig.js +0 -42
  60. package/dist/js/modern/config/initial/index.js +0 -16
  61. package/dist/js/modern/config/initial/inits.js +0 -152
  62. package/dist/js/modern/config/initial/transformNormalizedConfig.js +0 -47
  63. package/dist/js/modern/defineConfig.js +0 -27
  64. package/dist/js/modern/exports/server.js +0 -4
  65. package/dist/js/modern/hooks.js +0 -35
  66. package/dist/js/modern/index.js +0 -211
  67. package/dist/js/modern/initialize/index.js +0 -124
  68. package/dist/js/modern/locale/en.js +0 -36
  69. package/dist/js/modern/locale/index.js +0 -9
  70. package/dist/js/modern/locale/zh.js +0 -36
  71. package/dist/js/modern/schema/Schema.js +0 -40
  72. package/dist/js/modern/schema/index.js +0 -88
  73. package/dist/js/modern/schema/legacy.js +0 -148
  74. package/dist/js/modern/types/config/deploy.js +0 -0
  75. package/dist/js/modern/types/config/dev.js +0 -0
  76. package/dist/js/modern/types/config/experiments.js +0 -0
  77. package/dist/js/modern/types/config/html.js +0 -0
  78. package/dist/js/modern/types/config/index.js +0 -1
  79. package/dist/js/modern/types/config/output.js +0 -0
  80. package/dist/js/modern/types/config/performance.js +0 -0
  81. package/dist/js/modern/types/config/security.js +0 -0
  82. package/dist/js/modern/types/config/source.js +0 -0
  83. package/dist/js/modern/types/config/tools.js +0 -0
  84. package/dist/js/modern/types/hooks.js +0 -0
  85. package/dist/js/modern/types/index.js +0 -3
  86. package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
  87. package/dist/js/modern/types/legacyConfig/dev.js +0 -0
  88. package/dist/js/modern/types/legacyConfig/index.js +0 -0
  89. package/dist/js/modern/types/legacyConfig/output.js +0 -0
  90. package/dist/js/modern/types/legacyConfig/source.js +0 -0
  91. package/dist/js/modern/types/legacyConfig/tools.js +0 -0
  92. package/dist/js/modern/utils/config.js +0 -128
  93. package/dist/js/modern/utils/createServer.js +0 -75
  94. package/dist/js/modern/utils/env.js +0 -15
  95. package/dist/js/modern/utils/generateWatchFiles.js +0 -55
  96. package/dist/js/modern/utils/getSelectedEntries.js +0 -58
  97. package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
  98. package/dist/js/modern/utils/language.js +0 -8
  99. package/dist/js/modern/utils/printInstructions.js +0 -31
  100. package/dist/js/modern/utils/restart.js +0 -44
  101. package/dist/js/modern/utils/routes.js +0 -30
  102. package/dist/js/modern/utils/types.js +0 -0
  103. package/dist/js/node/analyze/constants.js +0 -98
  104. package/dist/js/node/analyze/generateCode.js +0 -271
  105. package/dist/js/node/analyze/getBundleEntry.js +0 -95
  106. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +0 -242
  107. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +0 -238
  108. package/dist/js/node/analyze/getClientRoutes/index.js +0 -30
  109. package/dist/js/node/analyze/getClientRoutes/utils.js +0 -58
  110. package/dist/js/node/analyze/getFileSystemEntry.js +0 -131
  111. package/dist/js/node/analyze/getHtmlTemplate.js +0 -144
  112. package/dist/js/node/analyze/getServerRoutes.js +0 -194
  113. package/dist/js/node/analyze/index.js +0 -339
  114. package/dist/js/node/analyze/isDefaultExportFunction.js +0 -71
  115. package/dist/js/node/analyze/makeLegalIdentifier.js +0 -36
  116. package/dist/js/node/analyze/nestedRoutes.js +0 -184
  117. package/dist/js/node/analyze/templates.js +0 -365
  118. package/dist/js/node/analyze/utils.js +0 -172
  119. package/dist/js/node/builder/builderPlugins/compatModern.js +0 -258
  120. package/dist/js/node/builder/index.js +0 -177
  121. package/dist/js/node/builder/loaders/routerLoader.js +0 -38
  122. package/dist/js/node/builder/loaders/serverModuleLoader.js +0 -28
  123. package/dist/js/node/builder/share.js +0 -75
  124. package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -53
  125. package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +0 -60
  126. package/dist/js/node/builder/webpackPlugins/routerPlugin.js +0 -135
  127. package/dist/js/node/commands/build.js +0 -112
  128. package/dist/js/node/commands/deploy.js +0 -51
  129. package/dist/js/node/commands/dev.js +0 -126
  130. package/dist/js/node/commands/index.js +0 -19
  131. package/dist/js/node/commands/inspect.js +0 -61
  132. package/dist/js/node/commands/serve.js +0 -83
  133. package/dist/js/node/config/default.js +0 -197
  134. package/dist/js/node/config/index.js +0 -34
  135. package/dist/js/node/config/initial/createHtmlConfig.js +0 -58
  136. package/dist/js/node/config/initial/createOutputConfig.js +0 -91
  137. package/dist/js/node/config/initial/createSourceConfig.js +0 -62
  138. package/dist/js/node/config/initial/createToolsConfig.js +0 -65
  139. package/dist/js/node/config/initial/index.js +0 -41
  140. package/dist/js/node/config/initial/inits.js +0 -175
  141. package/dist/js/node/config/initial/transformNormalizedConfig.js +0 -70
  142. package/dist/js/node/defineConfig.js +0 -49
  143. package/dist/js/node/exports/server.js +0 -27
  144. package/dist/js/node/hooks.js +0 -54
  145. package/dist/js/node/index.js +0 -235
  146. package/dist/js/node/initialize/index.js +0 -134
  147. package/dist/js/node/locale/en.js +0 -59
  148. package/dist/js/node/locale/index.js +0 -33
  149. package/dist/js/node/locale/zh.js +0 -59
  150. package/dist/js/node/schema/Schema.js +0 -63
  151. package/dist/js/node/schema/index.js +0 -118
  152. package/dist/js/node/schema/legacy.js +0 -169
  153. package/dist/js/node/types/config/deploy.js +0 -15
  154. package/dist/js/node/types/config/dev.js +0 -15
  155. package/dist/js/node/types/config/experiments.js +0 -15
  156. package/dist/js/node/types/config/html.js +0 -15
  157. package/dist/js/node/types/config/index.js +0 -17
  158. package/dist/js/node/types/config/output.js +0 -15
  159. package/dist/js/node/types/config/performance.js +0 -15
  160. package/dist/js/node/types/config/security.js +0 -15
  161. package/dist/js/node/types/config/source.js +0 -15
  162. package/dist/js/node/types/config/tools.js +0 -15
  163. package/dist/js/node/types/hooks.js +0 -15
  164. package/dist/js/node/types/index.js +0 -19
  165. package/dist/js/node/types/legacyConfig/deploy.js +0 -15
  166. package/dist/js/node/types/legacyConfig/dev.js +0 -15
  167. package/dist/js/node/types/legacyConfig/index.js +0 -15
  168. package/dist/js/node/types/legacyConfig/output.js +0 -15
  169. package/dist/js/node/types/legacyConfig/source.js +0 -15
  170. package/dist/js/node/types/legacyConfig/tools.js +0 -15
  171. package/dist/js/node/utils/config.js +0 -153
  172. package/dist/js/node/utils/createServer.js +0 -106
  173. package/dist/js/node/utils/env.js +0 -38
  174. package/dist/js/node/utils/generateWatchFiles.js +0 -85
  175. package/dist/js/node/utils/getSelectedEntries.js +0 -81
  176. package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
  177. package/dist/js/node/utils/language.js +0 -31
  178. package/dist/js/node/utils/printInstructions.js +0 -54
  179. package/dist/js/node/utils/restart.js +0 -67
  180. package/dist/js/node/utils/routes.js +0 -59
  181. package/dist/js/node/utils/types.js +0 -15
  182. package/dist/js/treeshaking/analyze/constants.js +0 -40
  183. package/dist/js/treeshaking/analyze/generateCode.js +0 -485
  184. package/dist/js/treeshaking/analyze/getBundleEntry.js +0 -62
  185. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +0 -233
  186. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +0 -231
  187. package/dist/js/treeshaking/analyze/getClientRoutes/index.js +0 -3
  188. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -23
  189. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +0 -107
  190. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +0 -302
  191. package/dist/js/treeshaking/analyze/getServerRoutes.js +0 -222
  192. package/dist/js/treeshaking/analyze/index.js +0 -697
  193. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -47
  194. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -13
  195. package/dist/js/treeshaking/analyze/nestedRoutes.js +0 -384
  196. package/dist/js/treeshaking/analyze/templates.js +0 -468
  197. package/dist/js/treeshaking/analyze/utils.js +0 -374
  198. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +0 -304
  199. package/dist/js/treeshaking/builder/index.js +0 -374
  200. package/dist/js/treeshaking/builder/loaders/routerLoader.js +0 -13
  201. package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +0 -5
  202. package/dist/js/treeshaking/builder/share.js +0 -40
  203. package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -110
  204. package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +0 -72
  205. package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +0 -343
  206. package/dist/js/treeshaking/commands/build.js +0 -291
  207. package/dist/js/treeshaking/commands/deploy.js +0 -154
  208. package/dist/js/treeshaking/commands/dev.js +0 -301
  209. package/dist/js/treeshaking/commands/index.js +0 -3
  210. package/dist/js/treeshaking/commands/inspect.js +0 -149
  211. package/dist/js/treeshaking/commands/serve.js +0 -199
  212. package/dist/js/treeshaking/config/default.js +0 -210
  213. package/dist/js/treeshaking/config/index.js +0 -3
  214. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +0 -19
  215. package/dist/js/treeshaking/config/initial/createOutputConfig.js +0 -41
  216. package/dist/js/treeshaking/config/initial/createSourceConfig.js +0 -42
  217. package/dist/js/treeshaking/config/initial/createToolsConfig.js +0 -23
  218. package/dist/js/treeshaking/config/initial/index.js +0 -12
  219. package/dist/js/treeshaking/config/initial/inits.js +0 -209
  220. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +0 -35
  221. package/dist/js/treeshaking/defineConfig.js +0 -61
  222. package/dist/js/treeshaking/exports/server.js +0 -2
  223. package/dist/js/treeshaking/hooks.js +0 -29
  224. package/dist/js/treeshaking/index.js +0 -706
  225. package/dist/js/treeshaking/initialize/index.js +0 -276
  226. package/dist/js/treeshaking/locale/en.js +0 -38
  227. package/dist/js/treeshaking/locale/index.js +0 -9
  228. package/dist/js/treeshaking/locale/zh.js +0 -38
  229. package/dist/js/treeshaking/schema/Schema.js +0 -273
  230. package/dist/js/treeshaking/schema/index.js +0 -181
  231. package/dist/js/treeshaking/schema/legacy.js +0 -337
  232. package/dist/js/treeshaking/types/config/deploy.js +0 -1
  233. package/dist/js/treeshaking/types/config/dev.js +0 -1
  234. package/dist/js/treeshaking/types/config/experiments.js +0 -1
  235. package/dist/js/treeshaking/types/config/html.js +0 -1
  236. package/dist/js/treeshaking/types/config/index.js +0 -1
  237. package/dist/js/treeshaking/types/config/output.js +0 -1
  238. package/dist/js/treeshaking/types/config/performance.js +0 -1
  239. package/dist/js/treeshaking/types/config/security.js +0 -1
  240. package/dist/js/treeshaking/types/config/source.js +0 -1
  241. package/dist/js/treeshaking/types/config/tools.js +0 -1
  242. package/dist/js/treeshaking/types/hooks.js +0 -1
  243. package/dist/js/treeshaking/types/index.js +0 -3
  244. package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -1
  245. package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -1
  246. package/dist/js/treeshaking/types/legacyConfig/index.js +0 -1
  247. package/dist/js/treeshaking/types/legacyConfig/output.js +0 -1
  248. package/dist/js/treeshaking/types/legacyConfig/source.js +0 -1
  249. package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -1
  250. package/dist/js/treeshaking/utils/config.js +0 -302
  251. package/dist/js/treeshaking/utils/createServer.js +0 -258
  252. package/dist/js/treeshaking/utils/env.js +0 -13
  253. package/dist/js/treeshaking/utils/generateWatchFiles.js +0 -214
  254. package/dist/js/treeshaking/utils/getSelectedEntries.js +0 -186
  255. package/dist/js/treeshaking/utils/getServerInternalPlugins.js +0 -210
  256. package/dist/js/treeshaking/utils/language.js +0 -6
  257. package/dist/js/treeshaking/utils/printInstructions.js +0 -152
  258. package/dist/js/treeshaking/utils/restart.js +0 -187
  259. package/dist/js/treeshaking/utils/routes.js +0 -153
  260. package/dist/js/treeshaking/utils/types.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @modern-js/app-tools
2
2
 
3
+ ## 2.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ab1e8065cb: feat: support router-plugin in Rspack bundler.
8
+ feat: 在 Rspack bundler 里支持 router-plugin
9
+
10
+ ### Patch Changes
11
+
12
+ - a12b5b4ec8: fix: the adapterSSR builder plugin modifyChain Hooks is not async function
13
+ fix: adapterSSR builder 插件的 adapterSSR Hooks 不是异步函数
14
+ - 1104a9f18b: feat: support start web service only
15
+ feat: 支持只启动 web 服务
16
+ - 1f6ca2c7fb: fix: nested routes in ssg
17
+ fix: 修复嵌套路由在 SSG 中的问题
18
+ - 2b6b1a014c: refactor: app-tools builder
19
+ refactor: 重构 app-tools builder
20
+ - 250f794c40: fix: move the analyze webpackChain config to app-tools builder shared
21
+ fix: 将 anylyze 的 `webpackChain` 配置项移植进 app-tools builder shared
22
+ - Updated dependencies [ea7bb41e30]
23
+ - Updated dependencies [65c56f43b9]
24
+ - Updated dependencies [0cf8540ffe]
25
+ - Updated dependencies [bd369a89a4]
26
+ - Updated dependencies [bc943c9b04]
27
+ - Updated dependencies [40f5039b17]
28
+ - Updated dependencies [1104a9f18b]
29
+ - Updated dependencies [70d82e1408]
30
+ - Updated dependencies [2c1151271d]
31
+ - Updated dependencies [481461a61d]
32
+ - Updated dependencies [1242f5d8d6]
33
+ - Updated dependencies [1f6ca2c7fb]
34
+ - Updated dependencies [457ee832b9]
35
+ - @modern-js/server@2.8.0
36
+ - @modern-js/builder-webpack-provider@2.8.0
37
+ - @modern-js/plugin-data-loader@2.8.0
38
+ - @modern-js/builder@2.8.0
39
+ - @modern-js/builder-shared@2.8.0
40
+ - @modern-js/builder-rspack-provider@2.8.0
41
+ - @modern-js/prod-server@2.8.0
42
+ - @modern-js/utils@2.8.0
43
+ - @modern-js/types@2.8.0
44
+ - @modern-js/builder-plugin-esbuild@2.8.0
45
+ - @modern-js/builder-plugin-node-polyfill@2.8.0
46
+ - @modern-js/core@2.8.0
47
+ - @modern-js/plugin-i18n@2.8.0
48
+ - @modern-js/plugin-lint@2.8.0
49
+ - @modern-js/new-action@2.8.0
50
+ - @modern-js/node-bundle-require@2.8.0
51
+ - @modern-js/upgrade@2.8.0
52
+ - @modern-js/plugin@2.8.0
53
+
3
54
  ## 2.7.0
4
55
 
5
56
  ### Minor Changes
@@ -167,8 +218,8 @@
167
218
 
168
219
  - e84d16b: feat: support catch-all routing
169
220
  feat: 支持通配路由
170
- - a914be8: feat: modern-js support rspack bundler
171
- feat: modern-js 支持 rspack 构建工具
221
+ - a914be8: feat: modern-js support Rspack bundler
222
+ feat: modern-js 支持 Rspack 构建工具
172
223
 
173
224
  ### Patch Changes
174
225
 
@@ -99,7 +99,6 @@ const generateCode = async (appContext, config, entrypoints, api) => {
99
99
  const getRoutes = isV5 ? import_getClientRoutes.getClientRoutesLegacy : import_getClientRoutes.getClientRoutes;
100
100
  await Promise.all(entrypoints.map(generateEntryCode));
101
101
  async function generateEntryCode(entrypoint) {
102
- var _a;
103
102
  const { entryName, isAutoMount, customBootstrap, fileSystemRoutes } = entrypoint;
104
103
  if (isAutoMount) {
105
104
  if (fileSystemRoutes) {
@@ -162,8 +161,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
162
161
  ssrMode: useSSG ? "string" : mode,
163
162
  nestedRoutesEntry: entrypoint.nestedRoutesEntry,
164
163
  entryName: entrypoint.entryName,
165
- internalDirectory,
166
- splitRoutesChunks: (_a = config2 == null ? void 0 : config2.output) == null ? void 0 : _a.splitRoutesChunks
164
+ internalDirectory
167
165
  })
168
166
  });
169
167
  if (entrypoint.nestedRoutesEntry && (0, import_utils.isUseSSRBundle)(config2)) {
@@ -177,6 +175,19 @@ const generateCode = async (appContext, config, entrypoints, api) => {
177
175
  await import_utils.fs.ensureFile(routesServerFile);
178
176
  await import_utils.fs.writeFile(routesServerFile, code3);
179
177
  }
178
+ const serverLoaderCombined = templates.ssrLoaderCombinedModule(
179
+ entrypoints,
180
+ entrypoint,
181
+ config2,
182
+ appContext
183
+ );
184
+ if (serverLoaderCombined) {
185
+ const serverLoaderFile = (0, import_utils2.getServerCombinedModueFile)(
186
+ internalDirectory,
187
+ entryName
188
+ );
189
+ await import_utils.fs.outputFile(serverLoaderFile, serverLoaderCombined);
190
+ }
180
191
  import_utils.fs.outputFileSync(
181
192
  import_path.default.resolve(
182
193
  internalDirectory,
@@ -33,7 +33,6 @@ module.exports = __toCommonJS(analyze_exports);
33
33
  var path = __toESM(require("path"));
34
34
  var import_utils = require("@modern-js/utils");
35
35
  var import_lodash = require("@modern-js/utils/lodash");
36
- var import_builder_shared = require("@modern-js/builder-shared");
37
36
  var import_printInstructions = require("../utils/printInstructions");
38
37
  var import_routes = require("../utils/routes");
39
38
  var import_config = require("../utils/config");
@@ -190,42 +189,6 @@ var analyze_default = ({
190
189
  watchFiles() {
191
190
  return pagesDir;
192
191
  },
193
- config() {
194
- return {
195
- tools: {
196
- webpackChain: (chain, { name }) => {
197
- const appContext = api.useAppContext();
198
- const resolvedConfig = api.useResolvedConfigContext();
199
- const { entrypoints, internalDirectory, packageName } = appContext;
200
- entrypoints.forEach((entrypoint) => {
201
- const { entryName } = entrypoint;
202
- const ssr = (0, import_utils.getEntryOptions)(
203
- entryName,
204
- resolvedConfig.server.ssr,
205
- resolvedConfig.server.ssrByEntries,
206
- packageName
207
- );
208
- const useSSG = (0, import_utils.isSSGEntry)(
209
- resolvedConfig,
210
- entryName,
211
- entrypoints
212
- );
213
- if (entrypoint.nestedRoutesEntry && (ssr || useSSG) && name === "server") {
214
- const serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
215
- const serverLoadersFile = (0, import_utils2.getServerLoadersFile)(
216
- internalDirectory,
217
- entryName
218
- );
219
- const combinedModule = (0, import_builder_shared.createVirtualModule)(
220
- `export * from "${serverLoaderRuntime}"; export * from "${serverLoadersFile}"`
221
- );
222
- chain.entry(`${entryName}-server-loaders`).add(combinedModule);
223
- }
224
- });
225
- }
226
- }
227
- };
228
- },
229
192
  resolvedConfig({ resolved }) {
230
193
  const appContext = api.useAppContext();
231
194
  const config = (0, import_config2.initialNormalizedConfig)(resolved, appContext, bundler);
@@ -284,14 +247,6 @@ var analyze_default = ({
284
247
  imports
285
248
  };
286
249
  },
287
- validateSchema() {
288
- return {
289
- target: "output.splitRoutesChunks",
290
- schema: {
291
- type: "boolean"
292
- }
293
- };
294
- },
295
250
  async fileChange(e) {
296
251
  const appContext = api.useAppContext();
297
252
  const { appDirectory } = appContext;
@@ -31,12 +31,14 @@ __export(templates_exports, {
31
31
  html: () => html,
32
32
  index: () => index,
33
33
  renderFunction: () => renderFunction,
34
- routesForServer: () => routesForServer
34
+ routesForServer: () => routesForServer,
35
+ ssrLoaderCombinedModule: () => ssrLoaderCombinedModule
35
36
  });
36
37
  module.exports = __toCommonJS(templates_exports);
37
38
  var import_path = __toESM(require("path"));
38
39
  var import_utils = require("@modern-js/utils");
39
40
  var import_constants = require("./constants");
41
+ var import_utils2 = require("./utils");
40
42
  const index = ({
41
43
  mountId,
42
44
  imports,
@@ -180,14 +182,12 @@ const fileSystemRoutes = async ({
180
182
  ssrMode,
181
183
  nestedRoutesEntry,
182
184
  entryName,
183
- internalDirectory,
184
- splitRoutesChunks = true
185
+ internalDirectory
185
186
  }) => {
186
187
  const loadings = [];
187
188
  const errors = [];
188
189
  const loaders = [];
189
190
  const loadersMap = {};
190
- const webpackMode = splitRoutesChunks ? "lazy" : "eager";
191
191
  const loadersMapFile = import_path.default.join(
192
192
  internalDirectory,
193
193
  entryName,
@@ -246,15 +246,15 @@ const fileSystemRoutes = async ({
246
246
  rootLayoutCode = `import RootLayout from '${route._component}'`;
247
247
  component = `RootLayout`;
248
248
  } else if (ssrMode === "string") {
249
- lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ /* webpackMode: "${webpackMode}" */ '${route._component}')`;
249
+ lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
250
250
  component = `loadable(${lazyImport})`;
251
251
  } else {
252
- lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ /* webpackMode: "${webpackMode}" */ '${route._component}')`;
252
+ lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
253
253
  component = `lazy(${lazyImport})`;
254
254
  }
255
255
  }
256
256
  } else if (route._component) {
257
- lazyImport = `() => import( /* webpackMode: "${webpackMode}" */ '${route._component}')`;
257
+ lazyImport = `() => import('${route._component}')`;
258
258
  component = `loadable(${lazyImport})`;
259
259
  }
260
260
  const finalRoute = {
@@ -321,11 +321,33 @@ const fileSystemRoutes = async ({
321
321
  ${routeComponentsCode}
322
322
  `;
323
323
  };
324
+ function ssrLoaderCombinedModule(entrypoints, entrypoint, config, appContext) {
325
+ const { entryName } = entrypoint;
326
+ const { packageName, internalDirectory } = appContext;
327
+ const ssr = (0, import_utils.getEntryOptions)(
328
+ entryName,
329
+ config.server.ssr,
330
+ config.server.ssrByEntries,
331
+ packageName
332
+ );
333
+ const ssg = (0, import_utils.isSSGEntry)(config, entryName, entrypoints);
334
+ if (entrypoint.nestedRoutesEntry && (ssr || ssg)) {
335
+ const serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
336
+ const serverLoadersFile = (0, import_utils2.getServerLoadersFile)(
337
+ internalDirectory,
338
+ entryName
339
+ );
340
+ const combinedModule = `export * from "${serverLoaderRuntime}"; export * from "${serverLoadersFile}"`;
341
+ return combinedModule;
342
+ }
343
+ return null;
344
+ }
324
345
  // Annotate the CommonJS export names for ESM import in node:
325
346
  0 && (module.exports = {
326
347
  fileSystemRoutes,
327
348
  html,
328
349
  index,
329
350
  renderFunction,
330
- routesForServer
351
+ routesForServer,
352
+ ssrLoaderCombinedModule
331
353
  });
@@ -28,6 +28,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
28
28
  var utils_exports = {};
29
29
  __export(utils_exports, {
30
30
  getDefaultImports: () => getDefaultImports,
31
+ getServerCombinedModueFile: () => getServerCombinedModueFile,
31
32
  getServerLoadersFile: () => getServerLoadersFile,
32
33
  hasLoader: () => hasLoader,
33
34
  isPageComponentFile: () => isPageComponentFile,
@@ -144,9 +145,13 @@ const hasLoader = async (filename) => {
144
145
  const getServerLoadersFile = (internalDirectory, entryName) => {
145
146
  return import_path.default.join(internalDirectory, entryName, "route-server-loaders.js");
146
147
  };
148
+ const getServerCombinedModueFile = (internalDirectory, entryName) => {
149
+ return import_path.default.join(internalDirectory, entryName, "server-loader-combined.js");
150
+ };
147
151
  // Annotate the CommonJS export names for ESM import in node:
148
152
  0 && (module.exports = {
149
153
  getDefaultImports,
154
+ getServerCombinedModueFile,
150
155
  getServerLoadersFile,
151
156
  hasLoader,
152
157
  isPageComponentFile,
@@ -37,7 +37,7 @@ async function createBuilderGenerator(bundler) {
37
37
  return createRspackBuilderForModern;
38
38
  } catch (_) {
39
39
  throw new Error(
40
- "Failed to use rspack, please check if you have `@modern-js/builder-rspack-provider` installed"
40
+ "Failed to use Rspack, please check if you have `@modern-js/builder-rspack-provider` installed"
41
41
  );
42
42
  }
43
43
  }
@@ -21,7 +21,9 @@ __export(adapterSSR_exports, {
21
21
  });
22
22
  module.exports = __toCommonJS(adapterSSR_exports);
23
23
  var import_builder_shared = require("@modern-js/builder-shared");
24
+ var import_utils = require("@modern-js/utils");
24
25
  var import_bundlerPlugins = require("../bundlerPlugins");
26
+ var import_utils2 = require("../../../analyze/utils");
25
27
  var import_adapterHtml = require("./adapterHtml");
26
28
  const builderPluginAdapterSSR = (options) => ({
27
29
  name: "builder-plugin-adapter-modern-ssr",
@@ -38,9 +40,10 @@ const builderPluginAdapterSSR = (options) => ({
38
40
  return config;
39
41
  });
40
42
  api.modifyBundlerChain(
41
- (chain, { target, CHAIN_ID, isProd, HtmlPlugin: HtmlBundlerPlugin }) => {
43
+ async (chain, { target, CHAIN_ID, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
42
44
  const builderConfig = api.getNormalizedConfig();
43
45
  applyRouterPlugin(chain, options);
46
+ await applySSRLoaderEntry(chain, options, isServer);
44
47
  if (["node", "service-worker"].includes(target)) {
45
48
  applyFilterEntriesBySSRConfig({
46
49
  isProd,
@@ -134,6 +137,27 @@ function applyFilterEntriesBySSRConfig({
134
137
  }
135
138
  });
136
139
  }
140
+ async function applySSRLoaderEntry(chain, optinos, isServer) {
141
+ const { appContext } = optinos;
142
+ const { internalDirectory } = appContext;
143
+ const { entrypoints } = appContext;
144
+ await Promise.all(
145
+ entrypoints.map(async (entrypoint) => {
146
+ const { entryName } = entrypoint;
147
+ const serverLoadersFile = (0, import_utils2.getServerCombinedModueFile)(
148
+ internalDirectory,
149
+ entryName
150
+ );
151
+ if (isServer) {
152
+ try {
153
+ await import_utils.fs.access(serverLoadersFile, import_utils.fs.constants.F_OK);
154
+ chain.entry(`${entryName}-server-loaders`).add(serverLoadersFile);
155
+ } catch (err) {
156
+ }
157
+ }
158
+ })
159
+ );
160
+ }
137
161
  // Annotate the CommonJS export names for ESM import in node:
138
162
  0 && (module.exports = {
139
163
  builderPluginAdapterSSR
@@ -152,7 +152,7 @@ import { fs, getEntryOptions, isRouterV5, isSSGEntry, isUseSSRBundle, logger } f
152
152
  import * as templates from "./templates";
153
153
  import { getClientRoutes, getClientRoutesLegacy } from "./getClientRoutes";
154
154
  import { FILE_SYSTEM_ROUTES_FILE_NAME, ENTRY_POINT_FILE_NAME, ENTRY_BOOTSTRAP_FILE_NAME } from "./constants";
155
- import { getDefaultImports, getServerLoadersFile } from "./utils";
155
+ import { getDefaultImports, getServerLoadersFile, getServerCombinedModueFile } from "./utils";
156
156
  import { walk } from "./nestedRoutes";
157
157
  var createImportSpecifier = function(specifiers) {
158
158
  var defaults = "";
@@ -245,18 +245,18 @@ var generateCode = function() {
245
245
  }
246
246
  function _generateEntryCode() {
247
247
  _generateEntryCode = _asyncToGenerator(function(entrypoint) {
248
- var entryName, isAutoMount, customBootstrap, fileSystemRoutes, _config2_output, initialRoutes, nestedRoute, routes, config2, ssr, useSSG, mode, hasPageRoute, _ref, code2, _, _tmp, routesServerFile, code3, _ref1, importStatements, plugins, _ref2, renderFunction, exportStatement, code, entryFile, _ref3, asyncEntryCode, bootstrapFile;
248
+ var entryName, isAutoMount, customBootstrap, fileSystemRoutes, initialRoutes, nestedRoute, routes, config2, ssr, useSSG, mode, hasPageRoute, _ref, code2, _, _tmp, routesServerFile, code3, serverLoaderCombined, serverLoaderFile, _ref1, importStatements, plugins, _ref2, renderFunction, exportStatement, code, entryFile, _ref3, asyncEntryCode, bootstrapFile;
249
249
  return __generator(this, function(_state) {
250
250
  switch(_state.label){
251
251
  case 0:
252
252
  entryName = entrypoint.entryName, isAutoMount = entrypoint.isAutoMount, customBootstrap = entrypoint.customBootstrap, fileSystemRoutes = entrypoint.fileSystemRoutes;
253
253
  if (!isAutoMount) return [
254
254
  3,
255
- 16
255
+ 18
256
256
  ];
257
257
  if (!fileSystemRoutes) return [
258
258
  3,
259
- 9
259
+ 11
260
260
  ];
261
261
  initialRoutes = [];
262
262
  nestedRoute = null;
@@ -322,8 +322,7 @@ var generateCode = function() {
322
322
  ssrMode: useSSG ? "string" : mode,
323
323
  nestedRoutesEntry: entrypoint.nestedRoutesEntry,
324
324
  entryName: entrypoint.entryName,
325
- internalDirectory: internalDirectory,
326
- splitRoutesChunks: config2 === null || config2 === void 0 ? void 0 : (_config2_output = config2.output) === null || _config2_output === void 0 ? void 0 : _config2_output.splitRoutesChunks
325
+ internalDirectory: internalDirectory
327
326
  })
328
327
  ];
329
328
  case 4:
@@ -357,9 +356,23 @@ var generateCode = function() {
357
356
  _state.sent();
358
357
  _state.label = 8;
359
358
  case 8:
360
- fs.outputFileSync(path.resolve(internalDirectory, "./".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_FILE_NAME)), code2, "utf8");
361
- _state.label = 9;
359
+ serverLoaderCombined = templates.ssrLoaderCombinedModule(entrypoints, entrypoint, config2, appContext);
360
+ if (!serverLoaderCombined) return [
361
+ 3,
362
+ 10
363
+ ];
364
+ serverLoaderFile = getServerCombinedModueFile(internalDirectory, entryName);
365
+ return [
366
+ 4,
367
+ fs.outputFile(serverLoaderFile, serverLoaderCombined)
368
+ ];
362
369
  case 9:
370
+ _state.sent();
371
+ _state.label = 10;
372
+ case 10:
373
+ fs.outputFileSync(path.resolve(internalDirectory, "./".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_FILE_NAME)), code2, "utf8");
374
+ _state.label = 11;
375
+ case 11:
363
376
  return [
364
377
  4,
365
378
  hookRunners.modifyEntryImports({
@@ -373,7 +386,7 @@ var generateCode = function() {
373
386
  })
374
387
  })
375
388
  ];
376
- case 10:
389
+ case 12:
377
390
  _ref1 = _state.sent(), importStatements = _ref1.imports;
378
391
  return [
379
392
  4,
@@ -382,7 +395,7 @@ var generateCode = function() {
382
395
  plugins: []
383
396
  })
384
397
  ];
385
- case 11:
398
+ case 13:
386
399
  plugins = _state.sent().plugins;
387
400
  return [
388
401
  4,
@@ -395,7 +408,7 @@ var generateCode = function() {
395
408
  })
396
409
  })
397
410
  ];
398
- case 12:
411
+ case 14:
399
412
  _ref2 = _state.sent(), renderFunction = _ref2.code;
400
413
  return [
401
414
  4,
@@ -404,7 +417,7 @@ var generateCode = function() {
404
417
  exportStatement: "export default AppWrapper;"
405
418
  })
406
419
  ];
407
- case 13:
420
+ case 15:
408
421
  exportStatement = _state.sent().exportStatement;
409
422
  code = templates.index({
410
423
  mountId: mountId,
@@ -416,7 +429,7 @@ var generateCode = function() {
416
429
  entrypoint.entry = entryFile;
417
430
  if (!config.source.enableAsyncEntry) return [
418
431
  3,
419
- 15
432
+ 17
420
433
  ];
421
434
  return [
422
435
  4,
@@ -425,19 +438,19 @@ var generateCode = function() {
425
438
  code: "import('./".concat(ENTRY_BOOTSTRAP_FILE_NAME, "');")
426
439
  })
427
440
  ];
428
- case 14:
441
+ case 16:
429
442
  _ref3 = _state.sent(), asyncEntryCode = _ref3.code;
430
443
  fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
431
444
  bootstrapFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_BOOTSTRAP_FILE_NAME));
432
445
  fs.outputFileSync(bootstrapFile, code, "utf8");
433
446
  return [
434
447
  3,
435
- 16
448
+ 18
436
449
  ];
437
- case 15:
450
+ case 17:
438
451
  fs.outputFileSync(entryFile, code, "utf8");
439
- _state.label = 16;
440
- case 16:
452
+ _state.label = 18;
453
+ case 18:
441
454
  return [
442
455
  2
443
456
  ];
@@ -221,16 +221,15 @@ var __generator = this && this.__generator || function(thisArg, body) {
221
221
  }
222
222
  };
223
223
  import * as path from "path";
224
- import { createDebugger, findExists, fs, getEntryOptions, isApiOnly, minimist, getCommand, isDevCommand, isSSGEntry } from "@modern-js/utils";
224
+ import { createDebugger, findExists, fs, isApiOnly, minimist, getCommand, isDevCommand } from "@modern-js/utils";
225
225
  import { cloneDeep } from "@modern-js/utils/lodash";
226
- import { createVirtualModule } from "@modern-js/builder-shared";
227
226
  import { printInstructions } from "../utils/printInstructions";
228
227
  import { generateRoutes } from "../utils/routes";
229
228
  import { emitResolvedConfig } from "../utils/config";
230
229
  import { getSelectedEntries } from "../utils/getSelectedEntries";
231
230
  import { initialNormalizedConfig } from "../config";
232
231
  import { createBuilderGenerator } from "../builder";
233
- import { getServerLoadersFile, isPageComponentFile, parseModule, replaceWithAlias } from "./utils";
232
+ import { isPageComponentFile, parseModule, replaceWithAlias } from "./utils";
234
233
  import { APP_CONFIG_NAME, APP_INIT_EXPORTED, APP_INIT_IMPORTED } from "./constants";
235
234
  var debug = createDebugger("plugin-analyze");
236
235
  var analyze_default = function(param) {
@@ -543,29 +542,6 @@ var analyze_default = function(param) {
543
542
  watchFiles: function watchFiles() {
544
543
  return pagesDir;
545
544
  },
546
- config: function config() {
547
- return {
548
- tools: {
549
- webpackChain: function(chain, param) {
550
- var name = param.name;
551
- var appContext = api.useAppContext();
552
- var resolvedConfig = api.useResolvedConfigContext();
553
- var entrypoints = appContext.entrypoints, internalDirectory = appContext.internalDirectory, packageName = appContext.packageName;
554
- entrypoints.forEach(function(entrypoint) {
555
- var entryName = entrypoint.entryName;
556
- var ssr = getEntryOptions(entryName, resolvedConfig.server.ssr, resolvedConfig.server.ssrByEntries, packageName);
557
- var useSSG = isSSGEntry(resolvedConfig, entryName, entrypoints);
558
- if (entrypoint.nestedRoutesEntry && (ssr || useSSG) && name === "server") {
559
- var serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
560
- var serverLoadersFile = getServerLoadersFile(internalDirectory, entryName);
561
- var combinedModule = createVirtualModule('export * from "'.concat(serverLoaderRuntime, '"; export * from "').concat(serverLoadersFile, '"'));
562
- chain.entry("".concat(entryName, "-server-loaders")).add(combinedModule);
563
- }
564
- });
565
- }
566
- }
567
- };
568
- },
569
545
  resolvedConfig: function resolvedConfig(param) {
570
546
  var resolved = param.resolved;
571
547
  var appContext = api.useAppContext();
@@ -662,14 +638,6 @@ var analyze_default = function(param) {
662
638
  });
663
639
  })();
664
640
  },
665
- validateSchema: function validateSchema() {
666
- return {
667
- target: "output.splitRoutesChunks",
668
- schema: {
669
- type: "boolean"
670
- }
671
- };
672
- },
673
641
  fileChange: function fileChange(e) {
674
642
  return _asyncToGenerator(function() {
675
643
  var appContext, appDirectory, filename, eventType, isPageFile, absoluteFilePath, isRouteComponent, resolvedConfig, generateCode, entrypoints;
@@ -221,8 +221,9 @@ var __generator = this && this.__generator || function(thisArg, body) {
221
221
  }
222
222
  };
223
223
  import path from "path";
224
- import { fs, slash } from "@modern-js/utils";
224
+ import { fs, getEntryOptions, isSSGEntry, slash } from "@modern-js/utils";
225
225
  import { APP_CONFIG_NAME, TEMP_LOADERS_DIR } from "./constants";
226
+ import { getServerLoadersFile } from "./utils";
226
227
  var index = function(param) {
227
228
  var mountId = param.mountId, imports = param.imports, renderFunction2 = param.renderFunction, exportStatement = param.exportStatement;
228
229
  return "\nconst IS_BROWSER = typeof window !== 'undefined' && window.name !== 'nodejs';\nconst IS_REACT18 = process.env.IS_REACT18 === 'true';\nconst MOUNT_ID = '".concat(mountId, "';\n\n").concat(imports, "\n\nlet AppWrapper = null;\n\nlet root = null;\n\nfunction render() {\n ").concat(renderFunction2, "\n}\n\nAppWrapper = render();\n\n").concat(exportStatement, ";\n");
@@ -297,16 +298,15 @@ var routesForServer = function(param) {
297
298
  };
298
299
  var fileSystemRoutes = function() {
299
300
  var _ref = _asyncToGenerator(function(param) {
300
- var routes, ssrMode, nestedRoutesEntry, entryName, internalDirectory, _param_splitRoutesChunks, splitRoutesChunks, loadings, errors, loaders, loadersMap, webpackMode, loadersMapFile, importLazyCode, rootLayoutCode, getDataLoaderPath, traverseRouteTree, routeComponentsCode, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, route, newRoute, component, finalRoute, importLoadingCode, importErrorComponentsCode, importLoadersCode, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, key, loaderInfo;
301
+ var routes, ssrMode, nestedRoutesEntry, entryName, internalDirectory, loadings, errors, loaders, loadersMap, loadersMapFile, importLazyCode, rootLayoutCode, getDataLoaderPath, traverseRouteTree, routeComponentsCode, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, route, newRoute, component, finalRoute, importLoadingCode, importErrorComponentsCode, importLoadersCode, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, key, loaderInfo;
301
302
  return __generator(this, function(_state) {
302
303
  switch(_state.label){
303
304
  case 0:
304
- routes = param.routes, ssrMode = param.ssrMode, nestedRoutesEntry = param.nestedRoutesEntry, entryName = param.entryName, internalDirectory = param.internalDirectory, _param_splitRoutesChunks = param.splitRoutesChunks, splitRoutesChunks = _param_splitRoutesChunks === void 0 ? true : _param_splitRoutesChunks;
305
+ routes = param.routes, ssrMode = param.ssrMode, nestedRoutesEntry = param.nestedRoutesEntry, entryName = param.entryName, internalDirectory = param.internalDirectory;
305
306
  loadings = [];
306
307
  errors = [];
307
308
  loaders = [];
308
309
  loadersMap = {};
309
- webpackMode = splitRoutesChunks ? "lazy" : "eager";
310
310
  loadersMapFile = path.join(internalDirectory, entryName, TEMP_LOADERS_DIR, "map.json");
311
311
  importLazyCode = '\n import { lazy } from "react";\n import loadable, { lazy as loadableLazy } from "@modern-js/runtime/loadable"\n ';
312
312
  rootLayoutCode = "";
@@ -355,15 +355,15 @@ var fileSystemRoutes = function() {
355
355
  rootLayoutCode = "import RootLayout from '".concat(route._component, "'");
356
356
  component = "RootLayout";
357
357
  } else if (ssrMode === "string") {
358
- lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, '" */ /* webpackMode: "').concat(webpackMode, "\" */ '").concat(route._component, "')");
358
+ lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, "\" */ '").concat(route._component, "')");
359
359
  component = "loadable(".concat(lazyImport, ")");
360
360
  } else {
361
- lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, '" */ /* webpackMode: "').concat(webpackMode, "\" */ '").concat(route._component, "')");
361
+ lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, "\" */ '").concat(route._component, "')");
362
362
  component = "lazy(".concat(lazyImport, ")");
363
363
  }
364
364
  }
365
365
  } else if (route._component) {
366
- lazyImport = '() => import( /* webpackMode: "'.concat(webpackMode, "\" */ '").concat(route._component, "')");
366
+ lazyImport = "() => import('".concat(route._component, "')");
367
367
  component = "loadable(".concat(lazyImport, ")");
368
368
  }
369
369
  var finalRoute = _objectSpreadProps(_objectSpread({}, route), {
@@ -463,4 +463,17 @@ var fileSystemRoutes = function() {
463
463
  return _ref.apply(this, arguments);
464
464
  };
465
465
  }();
466
- export { fileSystemRoutes, html, index, renderFunction, routesForServer };
466
+ function ssrLoaderCombinedModule(entrypoints, entrypoint, config, appContext) {
467
+ var entryName = entrypoint.entryName;
468
+ var packageName = appContext.packageName, internalDirectory = appContext.internalDirectory;
469
+ var ssr = getEntryOptions(entryName, config.server.ssr, config.server.ssrByEntries, packageName);
470
+ var ssg = isSSGEntry(config, entryName, entrypoints);
471
+ if (entrypoint.nestedRoutesEntry && (ssr || ssg)) {
472
+ var serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
473
+ var serverLoadersFile = getServerLoadersFile(internalDirectory, entryName);
474
+ var combinedModule = 'export * from "'.concat(serverLoaderRuntime, '"; export * from "').concat(serverLoadersFile, '"');
475
+ return combinedModule;
476
+ }
477
+ return null;
478
+ }
479
+ export { fileSystemRoutes, html, index, renderFunction, routesForServer, ssrLoaderCombinedModule };
@@ -371,4 +371,7 @@ var hasLoader = function() {
371
371
  var getServerLoadersFile = function(internalDirectory, entryName) {
372
372
  return path.join(internalDirectory, entryName, "route-server-loaders.js");
373
373
  };
374
- export { getDefaultImports, getServerLoadersFile, hasLoader, isPageComponentFile, parseModule, replaceWithAlias, walkDirectory };
374
+ var getServerCombinedModueFile = function(internalDirectory, entryName) {
375
+ return path.join(internalDirectory, entryName, "server-loader-combined.js");
376
+ };
377
+ export { getDefaultImports, getServerCombinedModueFile, getServerLoadersFile, hasLoader, isPageComponentFile, parseModule, replaceWithAlias, walkDirectory };
@@ -155,7 +155,7 @@ function _createBuilderGenerator() {
155
155
  ];
156
156
  case 3:
157
157
  _ = _state.sent();
158
- throw new Error("Failed to use rspack, please check if you have `@modern-js/builder-rspack-provider` installed");
158
+ throw new Error("Failed to use Rspack, please check if you have `@modern-js/builder-rspack-provider` installed");
159
159
  case 4:
160
160
  return [
161
161
  4,