@modern-js/app-tools 2.8.1-alpha.3 → 2.10.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 (290) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/dist/cjs/analyze/generateCode.js +3 -1
  3. package/dist/cjs/analyze/index.js +8 -0
  4. package/dist/cjs/analyze/templates.js +45 -14
  5. package/dist/cjs/builder/builder-rspack/index.js +22 -1
  6. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +6 -3
  7. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +3 -0
  8. package/dist/esm/analyze/generateCode.js +3 -2
  9. package/dist/esm/analyze/index.js +8 -0
  10. package/dist/esm/analyze/templates.js +54 -16
  11. package/dist/esm/builder/builder-rspack/index.js +169 -1
  12. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +10 -3
  13. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +3 -0
  14. package/dist/esm-node/analyze/generateCode.js +3 -1
  15. package/dist/esm-node/analyze/index.js +8 -0
  16. package/dist/esm-node/analyze/templates.js +45 -14
  17. package/dist/esm-node/builder/builder-rspack/index.js +12 -1
  18. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +7 -4
  19. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +3 -0
  20. package/dist/types/analyze/templates.d.ts +3 -1
  21. package/dist/types/builder/builder-rspack/index.d.ts +2 -1
  22. package/dist/types/types/config/output.d.ts +1 -0
  23. package/package.json +31 -27
  24. package/dist/js/modern/analyze/constants.js +0 -56
  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 -178
  34. package/dist/js/modern/analyze/index.js +0 -333
  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 -186
  38. package/dist/js/modern/analyze/templates.js +0 -328
  39. package/dist/js/modern/analyze/utils.js +0 -141
  40. package/dist/js/modern/builder/builder-rspack/index.js +0 -8
  41. package/dist/js/modern/builder/builder-webpack/builderPlugins/compatModern.js +0 -41
  42. package/dist/js/modern/builder/builder-webpack/index.js +0 -93
  43. package/dist/js/modern/builder/builder-webpack/webpackPlugins/RouterPlugin.js +0 -116
  44. package/dist/js/modern/builder/builder-webpack/webpackPlugins/index.js +0 -1
  45. package/dist/js/modern/builder/generator/createBuilderOptions.js +0 -24
  46. package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
  47. package/dist/js/modern/builder/generator/getBuilderTargets.js +0 -21
  48. package/dist/js/modern/builder/generator/index.js +0 -53
  49. package/dist/js/modern/builder/index.js +0 -39
  50. package/dist/js/modern/builder/shared/builderPlugins/adapterModern.js +0 -219
  51. package/dist/js/modern/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -27
  52. package/dist/js/modern/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -34
  53. package/dist/js/modern/builder/shared/createCopyPattern.js +0 -46
  54. package/dist/js/modern/builder/shared/index.js +0 -3
  55. package/dist/js/modern/builder/shared/loaders/serverModuleLoader.js +0 -7
  56. package/dist/js/modern/builder/shared/types.js +0 -0
  57. package/dist/js/modern/commands/build.js +0 -91
  58. package/dist/js/modern/commands/deploy.js +0 -28
  59. package/dist/js/modern/commands/dev.js +0 -109
  60. package/dist/js/modern/commands/index.js +0 -3
  61. package/dist/js/modern/commands/inspect.js +0 -38
  62. package/dist/js/modern/commands/serve.js +0 -54
  63. package/dist/js/modern/config/default.js +0 -175
  64. package/dist/js/modern/config/index.js +0 -3
  65. package/dist/js/modern/config/initialize/index.js +0 -12
  66. package/dist/js/modern/config/initialize/inits.js +0 -154
  67. package/dist/js/modern/config/legacy/createHtmlConfig.js +0 -35
  68. package/dist/js/modern/config/legacy/createOutputConfig.js +0 -68
  69. package/dist/js/modern/config/legacy/createSourceConfig.js +0 -39
  70. package/dist/js/modern/config/legacy/createToolsConfig.js +0 -42
  71. package/dist/js/modern/config/legacy/index.js +0 -51
  72. package/dist/js/modern/defineConfig.js +0 -27
  73. package/dist/js/modern/exports/server.js +0 -4
  74. package/dist/js/modern/hooks.js +0 -35
  75. package/dist/js/modern/index.js +0 -221
  76. package/dist/js/modern/initialize/index.js +0 -132
  77. package/dist/js/modern/locale/en.js +0 -36
  78. package/dist/js/modern/locale/index.js +0 -9
  79. package/dist/js/modern/locale/zh.js +0 -36
  80. package/dist/js/modern/schema/Schema.js +0 -40
  81. package/dist/js/modern/schema/index.js +0 -88
  82. package/dist/js/modern/schema/legacy.js +0 -148
  83. package/dist/js/modern/types/config/deploy.js +0 -0
  84. package/dist/js/modern/types/config/dev.js +0 -0
  85. package/dist/js/modern/types/config/experiments.js +0 -0
  86. package/dist/js/modern/types/config/html.js +0 -0
  87. package/dist/js/modern/types/config/index.js +0 -1
  88. package/dist/js/modern/types/config/output.js +0 -0
  89. package/dist/js/modern/types/config/performance.js +0 -0
  90. package/dist/js/modern/types/config/security.js +0 -0
  91. package/dist/js/modern/types/config/source.js +0 -0
  92. package/dist/js/modern/types/config/tools.js +0 -0
  93. package/dist/js/modern/types/hooks.js +0 -0
  94. package/dist/js/modern/types/index.js +0 -3
  95. package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
  96. package/dist/js/modern/types/legacyConfig/dev.js +0 -0
  97. package/dist/js/modern/types/legacyConfig/index.js +0 -0
  98. package/dist/js/modern/types/legacyConfig/output.js +0 -0
  99. package/dist/js/modern/types/legacyConfig/source.js +0 -0
  100. package/dist/js/modern/types/legacyConfig/tools.js +0 -0
  101. package/dist/js/modern/types/utils.js +0 -0
  102. package/dist/js/modern/utils/config.js +0 -128
  103. package/dist/js/modern/utils/createServer.js +0 -75
  104. package/dist/js/modern/utils/env.js +0 -15
  105. package/dist/js/modern/utils/generateWatchFiles.js +0 -55
  106. package/dist/js/modern/utils/getSelectedEntries.js +0 -58
  107. package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
  108. package/dist/js/modern/utils/language.js +0 -8
  109. package/dist/js/modern/utils/printInstructions.js +0 -31
  110. package/dist/js/modern/utils/restart.js +0 -44
  111. package/dist/js/modern/utils/routes.js +0 -30
  112. package/dist/js/modern/utils/types.js +0 -0
  113. package/dist/js/node/analyze/constants.js +0 -100
  114. package/dist/js/node/analyze/generateCode.js +0 -271
  115. package/dist/js/node/analyze/getBundleEntry.js +0 -95
  116. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +0 -242
  117. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +0 -238
  118. package/dist/js/node/analyze/getClientRoutes/index.js +0 -30
  119. package/dist/js/node/analyze/getClientRoutes/utils.js +0 -58
  120. package/dist/js/node/analyze/getFileSystemEntry.js +0 -131
  121. package/dist/js/node/analyze/getHtmlTemplate.js +0 -144
  122. package/dist/js/node/analyze/getServerRoutes.js +0 -196
  123. package/dist/js/node/analyze/index.js +0 -340
  124. package/dist/js/node/analyze/isDefaultExportFunction.js +0 -71
  125. package/dist/js/node/analyze/makeLegalIdentifier.js +0 -36
  126. package/dist/js/node/analyze/nestedRoutes.js +0 -213
  127. package/dist/js/node/analyze/templates.js +0 -359
  128. package/dist/js/node/analyze/utils.js +0 -172
  129. package/dist/js/node/builder/builder-rspack/index.js +0 -31
  130. package/dist/js/node/builder/builder-webpack/builderPlugins/compatModern.js +0 -64
  131. package/dist/js/node/builder/builder-webpack/index.js +0 -118
  132. package/dist/js/node/builder/builder-webpack/webpackPlugins/RouterPlugin.js +0 -140
  133. package/dist/js/node/builder/builder-webpack/webpackPlugins/index.js +0 -17
  134. package/dist/js/node/builder/generator/createBuilderOptions.js +0 -47
  135. package/dist/js/node/builder/generator/createBuilderProviderConfig.js +0 -60
  136. package/dist/js/node/builder/generator/getBuilderTargets.js +0 -39
  137. package/dist/js/node/builder/generator/index.js +0 -82
  138. package/dist/js/node/builder/index.js +0 -68
  139. package/dist/js/node/builder/shared/builderPlugins/adapterModern.js +0 -245
  140. package/dist/js/node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -50
  141. package/dist/js/node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -57
  142. package/dist/js/node/builder/shared/createCopyPattern.js +0 -75
  143. package/dist/js/node/builder/shared/index.js +0 -19
  144. package/dist/js/node/builder/shared/loaders/serverModuleLoader.js +0 -28
  145. package/dist/js/node/builder/shared/types.js +0 -15
  146. package/dist/js/node/commands/build.js +0 -112
  147. package/dist/js/node/commands/deploy.js +0 -51
  148. package/dist/js/node/commands/dev.js +0 -126
  149. package/dist/js/node/commands/index.js +0 -19
  150. package/dist/js/node/commands/inspect.js +0 -61
  151. package/dist/js/node/commands/serve.js +0 -83
  152. package/dist/js/node/config/default.js +0 -197
  153. package/dist/js/node/config/index.js +0 -19
  154. package/dist/js/node/config/initialize/index.js +0 -35
  155. package/dist/js/node/config/initialize/inits.js +0 -177
  156. package/dist/js/node/config/legacy/createHtmlConfig.js +0 -58
  157. package/dist/js/node/config/legacy/createOutputConfig.js +0 -91
  158. package/dist/js/node/config/legacy/createSourceConfig.js +0 -62
  159. package/dist/js/node/config/legacy/createToolsConfig.js +0 -65
  160. package/dist/js/node/config/legacy/index.js +0 -75
  161. package/dist/js/node/defineConfig.js +0 -49
  162. package/dist/js/node/exports/server.js +0 -27
  163. package/dist/js/node/hooks.js +0 -54
  164. package/dist/js/node/index.js +0 -245
  165. package/dist/js/node/initialize/index.js +0 -141
  166. package/dist/js/node/locale/en.js +0 -59
  167. package/dist/js/node/locale/index.js +0 -33
  168. package/dist/js/node/locale/zh.js +0 -59
  169. package/dist/js/node/schema/Schema.js +0 -63
  170. package/dist/js/node/schema/index.js +0 -118
  171. package/dist/js/node/schema/legacy.js +0 -169
  172. package/dist/js/node/types/config/deploy.js +0 -15
  173. package/dist/js/node/types/config/dev.js +0 -15
  174. package/dist/js/node/types/config/experiments.js +0 -15
  175. package/dist/js/node/types/config/html.js +0 -15
  176. package/dist/js/node/types/config/index.js +0 -17
  177. package/dist/js/node/types/config/output.js +0 -15
  178. package/dist/js/node/types/config/performance.js +0 -15
  179. package/dist/js/node/types/config/security.js +0 -15
  180. package/dist/js/node/types/config/source.js +0 -15
  181. package/dist/js/node/types/config/tools.js +0 -15
  182. package/dist/js/node/types/hooks.js +0 -15
  183. package/dist/js/node/types/index.js +0 -19
  184. package/dist/js/node/types/legacyConfig/deploy.js +0 -15
  185. package/dist/js/node/types/legacyConfig/dev.js +0 -15
  186. package/dist/js/node/types/legacyConfig/index.js +0 -15
  187. package/dist/js/node/types/legacyConfig/output.js +0 -15
  188. package/dist/js/node/types/legacyConfig/source.js +0 -15
  189. package/dist/js/node/types/legacyConfig/tools.js +0 -15
  190. package/dist/js/node/types/utils.js +0 -15
  191. package/dist/js/node/utils/config.js +0 -153
  192. package/dist/js/node/utils/createServer.js +0 -106
  193. package/dist/js/node/utils/env.js +0 -38
  194. package/dist/js/node/utils/generateWatchFiles.js +0 -85
  195. package/dist/js/node/utils/getSelectedEntries.js +0 -81
  196. package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
  197. package/dist/js/node/utils/language.js +0 -31
  198. package/dist/js/node/utils/printInstructions.js +0 -54
  199. package/dist/js/node/utils/restart.js +0 -67
  200. package/dist/js/node/utils/routes.js +0 -59
  201. package/dist/js/node/utils/types.js +0 -15
  202. package/dist/js/treeshaking/analyze/constants.js +0 -42
  203. package/dist/js/treeshaking/analyze/generateCode.js +0 -485
  204. package/dist/js/treeshaking/analyze/getBundleEntry.js +0 -62
  205. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +0 -233
  206. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +0 -231
  207. package/dist/js/treeshaking/analyze/getClientRoutes/index.js +0 -3
  208. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -23
  209. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +0 -107
  210. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +0 -302
  211. package/dist/js/treeshaking/analyze/getServerRoutes.js +0 -224
  212. package/dist/js/treeshaking/analyze/index.js +0 -702
  213. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -47
  214. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -13
  215. package/dist/js/treeshaking/analyze/nestedRoutes.js +0 -409
  216. package/dist/js/treeshaking/analyze/templates.js +0 -465
  217. package/dist/js/treeshaking/analyze/utils.js +0 -374
  218. package/dist/js/treeshaking/builder/builder-rspack/index.js +0 -6
  219. package/dist/js/treeshaking/builder/builder-webpack/builderPlugins/compatModern.js +0 -64
  220. package/dist/js/treeshaking/builder/builder-webpack/index.js +0 -301
  221. package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/RouterPlugin.js +0 -346
  222. package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/index.js +0 -1
  223. package/dist/js/treeshaking/builder/generator/createBuilderOptions.js +0 -41
  224. package/dist/js/treeshaking/builder/generator/createBuilderProviderConfig.js +0 -70
  225. package/dist/js/treeshaking/builder/generator/getBuilderTargets.js +0 -16
  226. package/dist/js/treeshaking/builder/generator/index.js +0 -199
  227. package/dist/js/treeshaking/builder/index.js +0 -175
  228. package/dist/js/treeshaking/builder/shared/builderPlugins/adapterModern.js +0 -300
  229. package/dist/js/treeshaking/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -110
  230. package/dist/js/treeshaking/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -72
  231. package/dist/js/treeshaking/builder/shared/createCopyPattern.js +0 -40
  232. package/dist/js/treeshaking/builder/shared/index.js +0 -3
  233. package/dist/js/treeshaking/builder/shared/loaders/serverModuleLoader.js +0 -5
  234. package/dist/js/treeshaking/builder/shared/types.js +0 -1
  235. package/dist/js/treeshaking/commands/build.js +0 -291
  236. package/dist/js/treeshaking/commands/deploy.js +0 -154
  237. package/dist/js/treeshaking/commands/dev.js +0 -301
  238. package/dist/js/treeshaking/commands/index.js +0 -3
  239. package/dist/js/treeshaking/commands/inspect.js +0 -149
  240. package/dist/js/treeshaking/commands/serve.js +0 -199
  241. package/dist/js/treeshaking/config/default.js +0 -210
  242. package/dist/js/treeshaking/config/index.js +0 -3
  243. package/dist/js/treeshaking/config/initialize/index.js +0 -10
  244. package/dist/js/treeshaking/config/initialize/inits.js +0 -211
  245. package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
  246. package/dist/js/treeshaking/config/legacy/createOutputConfig.js +0 -41
  247. package/dist/js/treeshaking/config/legacy/createSourceConfig.js +0 -42
  248. package/dist/js/treeshaking/config/legacy/createToolsConfig.js +0 -23
  249. package/dist/js/treeshaking/config/legacy/index.js +0 -38
  250. package/dist/js/treeshaking/defineConfig.js +0 -61
  251. package/dist/js/treeshaking/exports/server.js +0 -2
  252. package/dist/js/treeshaking/hooks.js +0 -29
  253. package/dist/js/treeshaking/index.js +0 -713
  254. package/dist/js/treeshaking/initialize/index.js +0 -284
  255. package/dist/js/treeshaking/locale/en.js +0 -38
  256. package/dist/js/treeshaking/locale/index.js +0 -9
  257. package/dist/js/treeshaking/locale/zh.js +0 -38
  258. package/dist/js/treeshaking/schema/Schema.js +0 -273
  259. package/dist/js/treeshaking/schema/index.js +0 -181
  260. package/dist/js/treeshaking/schema/legacy.js +0 -337
  261. package/dist/js/treeshaking/types/config/deploy.js +0 -1
  262. package/dist/js/treeshaking/types/config/dev.js +0 -1
  263. package/dist/js/treeshaking/types/config/experiments.js +0 -1
  264. package/dist/js/treeshaking/types/config/html.js +0 -1
  265. package/dist/js/treeshaking/types/config/index.js +0 -1
  266. package/dist/js/treeshaking/types/config/output.js +0 -1
  267. package/dist/js/treeshaking/types/config/performance.js +0 -1
  268. package/dist/js/treeshaking/types/config/security.js +0 -1
  269. package/dist/js/treeshaking/types/config/source.js +0 -1
  270. package/dist/js/treeshaking/types/config/tools.js +0 -1
  271. package/dist/js/treeshaking/types/hooks.js +0 -1
  272. package/dist/js/treeshaking/types/index.js +0 -3
  273. package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -1
  274. package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -1
  275. package/dist/js/treeshaking/types/legacyConfig/index.js +0 -1
  276. package/dist/js/treeshaking/types/legacyConfig/output.js +0 -1
  277. package/dist/js/treeshaking/types/legacyConfig/source.js +0 -1
  278. package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -1
  279. package/dist/js/treeshaking/types/utils.js +0 -1
  280. package/dist/js/treeshaking/utils/config.js +0 -302
  281. package/dist/js/treeshaking/utils/createServer.js +0 -258
  282. package/dist/js/treeshaking/utils/env.js +0 -13
  283. package/dist/js/treeshaking/utils/generateWatchFiles.js +0 -214
  284. package/dist/js/treeshaking/utils/getSelectedEntries.js +0 -186
  285. package/dist/js/treeshaking/utils/getServerInternalPlugins.js +0 -210
  286. package/dist/js/treeshaking/utils/language.js +0 -6
  287. package/dist/js/treeshaking/utils/printInstructions.js +0 -152
  288. package/dist/js/treeshaking/utils/restart.js +0 -187
  289. package/dist/js/treeshaking/utils/routes.js +0 -153
  290. package/dist/js/treeshaking/utils/types.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,105 @@
1
1
  # @modern-js/app-tools
2
2
 
3
+ ## 2.10.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 0da32d0: chore: upgrade jest and puppeteer
8
+ chore: 升级 jest 和 puppeteer 到 latest
9
+ - 0d9962b: fix: add types field in package.json
10
+ fix: 添加 package.json 中的 types 字段
11
+ - fbefa7e: chore(deps): bump webpack from 5.75.0 to 5.76.2
12
+
13
+ chore(deps): 将 webpack 从 5.75.0 升级至 5.76.2
14
+
15
+ - 7b5dd99: feat(app-tools): support builder-plugin-node-polyfill & output.disableNodePolyfill false when use Rspack
16
+
17
+ feat(app-tools): 在启动 Rspack 时,支持 builder-plugin-node-polyfill 插件以及将 output.disableNodePolyfill 设置为 false
18
+
19
+ - 6db4864: feat: add output.splitRouteChunks
20
+ feat: 添加 output.splitRouteChunks 配置
21
+ - dcc5610: perf: improve routerPlugin performance
22
+ perf: 优化 routerPlugin 的性能
23
+ - 84c4372: fix: should get publicPath from webpack stats in router-plugin
24
+ fix: 应该从 webpack stats 获得 publicPath
25
+ - Updated dependencies [d8bbf28]
26
+ - Updated dependencies [a8db932]
27
+ - Updated dependencies [3e0bd50]
28
+ - Updated dependencies [92d247f]
29
+ - Updated dependencies [0da32d0]
30
+ - Updated dependencies [d3f0642]
31
+ - Updated dependencies [a16b9b0]
32
+ - Updated dependencies [0d9962b]
33
+ - Updated dependencies [fbefa7e]
34
+ - Updated dependencies [4d54233]
35
+ - Updated dependencies [6db4864]
36
+ - Updated dependencies [82326ee]
37
+ - Updated dependencies [d6b6e29]
38
+ - Updated dependencies [cfdbf80]
39
+ - Updated dependencies [ed55acb]
40
+ - @modern-js/prod-server@2.10.0
41
+ - @modern-js/builder-webpack-provider@2.10.0
42
+ - @modern-js/builder-rspack-provider@2.10.0
43
+ - @modern-js/builder-shared@2.10.0
44
+ - @modern-js/plugin-data-loader@2.10.0
45
+ - @modern-js/server@2.10.0
46
+ - @modern-js/types@2.10.0
47
+ - @modern-js/node-bundle-require@2.10.0
48
+ - @modern-js/new-action@2.10.0
49
+ - @modern-js/plugin-i18n@2.10.0
50
+ - @modern-js/plugin-lint@2.10.0
51
+ - @modern-js/upgrade@2.10.0
52
+ - @modern-js/plugin@2.10.0
53
+ - @modern-js/utils@2.10.0
54
+ - @modern-js/core@2.10.0
55
+ - @modern-js/builder-plugin-esbuild@2.10.0
56
+ - @modern-js/builder-plugin-node-polyfill@2.10.0
57
+ - @modern-js/builder@2.10.0
58
+
59
+ ## 2.9.0
60
+
61
+ ### Patch Changes
62
+
63
+ - 49bb8cd0ef: fix: move chunkmap.css comment to bottom of head
64
+ fix: 将 chunkmap.css 标记移动到 head 底部
65
+ - 83423193bb: fix: fix chunk css location in template
66
+ fix: 修复异步加载的 css 在模版文件中的位置
67
+ - e1b6881b39: fix: should not replace to alias when filePath is not in src
68
+ fix: 不应该替换为别名,当 filePath 不在 src 目录中时
69
+ - 5cb90eddaf: fix: fix data-loader compat in windows
70
+ fix: 修复 data loader 在 windows 下的兼容性问题
71
+ - e9ae517226: fix: optimize the regexp for route matching rules
72
+ fix: 优化路由匹配正则
73
+ - 4d89ad2a86: fix: the asset may be removed by InlineChunkHtmlPlugin
74
+ fix: asset 可能会被 InlineChunkHtmlPlugin 移除
75
+ - Updated dependencies [7035d5c22f]
76
+ - Updated dependencies [49bb8cd0ef]
77
+ - Updated dependencies [76b26883bb]
78
+ - Updated dependencies [f31a254d78]
79
+ - Updated dependencies [1f047183c3]
80
+ - Updated dependencies [88328d914b]
81
+ - Updated dependencies [dd56401486]
82
+ - Updated dependencies [07569e577e]
83
+ - Updated dependencies [da66232feb]
84
+ - @modern-js/builder-webpack-provider@2.9.0
85
+ - @modern-js/prod-server@2.9.0
86
+ - @modern-js/server@2.9.0
87
+ - @modern-js/builder-rspack-provider@2.9.0
88
+ - @modern-js/builder@2.9.0
89
+ - @modern-js/core@2.9.0
90
+ - @modern-js/builder-plugin-esbuild@2.9.0
91
+ - @modern-js/builder-plugin-node-polyfill@2.9.0
92
+ - @modern-js/builder-shared@2.9.0
93
+ - @modern-js/plugin-data-loader@2.9.0
94
+ - @modern-js/plugin-lint@2.9.0
95
+ - @modern-js/new-action@2.9.0
96
+ - @modern-js/plugin-i18n@2.9.0
97
+ - @modern-js/node-bundle-require@2.9.0
98
+ - @modern-js/plugin@2.9.0
99
+ - @modern-js/types@2.9.0
100
+ - @modern-js/upgrade@2.9.0
101
+ - @modern-js/utils@2.9.0
102
+
3
103
  ## 2.8.0
4
104
 
5
105
  ### Minor Changes
@@ -99,6 +99,7 @@ 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;
102
103
  const { entryName, isAutoMount, customBootstrap, fileSystemRoutes } = entrypoint;
103
104
  if (isAutoMount) {
104
105
  if (fileSystemRoutes) {
@@ -161,7 +162,8 @@ const generateCode = async (appContext, config, entrypoints, api) => {
161
162
  ssrMode: useSSG ? "string" : mode,
162
163
  nestedRoutesEntry: entrypoint.nestedRoutesEntry,
163
164
  entryName: entrypoint.entryName,
164
- internalDirectory
165
+ internalDirectory,
166
+ splitRouteChunks: (_a = config2 == null ? void 0 : config2.output) == null ? void 0 : _a.splitRouteChunks
165
167
  })
166
168
  });
167
169
  if (entrypoint.nestedRoutesEntry && (0, import_utils.isUseSSRBundle)(config2)) {
@@ -247,6 +247,14 @@ var analyze_default = ({
247
247
  imports
248
248
  };
249
249
  },
250
+ validateSchema() {
251
+ return {
252
+ target: "output.splitRouteChunks",
253
+ schema: {
254
+ type: "boolean"
255
+ }
256
+ };
257
+ },
250
258
  async fileChange(e) {
251
259
  const appContext = api.useAppContext();
252
260
  const { appDirectory } = appContext;
@@ -113,7 +113,6 @@ const html = (partials) => `
113
113
  </head>
114
114
 
115
115
  <body>
116
- <!--<?- chunksMap.css ?>-->
117
116
  <noscript>
118
117
  We're sorry but react app doesn't work properly without JavaScript enabled. Please enable it to continue.
119
118
  </noscript>
@@ -177,13 +176,16 @@ const routesForServer = ({
177
176
  ${routesCode}
178
177
  `;
179
178
  };
179
+ const createMatchReg = (keyword) => new RegExp(`("${keyword}":\\s)"([^,]+)"`, "g");
180
180
  const fileSystemRoutes = async ({
181
181
  routes,
182
182
  ssrMode,
183
183
  nestedRoutesEntry,
184
184
  entryName,
185
- internalDirectory
185
+ internalDirectory,
186
+ splitRouteChunks = true
186
187
  }) => {
188
+ const components = [];
187
189
  const loadings = [];
188
190
  const errors = [];
189
191
  const loaders = [];
@@ -242,20 +244,30 @@ const fileSystemRoutes = async ({
242
244
  };
243
245
  }
244
246
  if (route._component) {
245
- if (route.isRoot) {
246
- rootLayoutCode = `import RootLayout from '${route._component}'`;
247
- component = `RootLayout`;
248
- } else if (ssrMode === "string") {
249
- lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
250
- component = `loadable(${lazyImport})`;
247
+ if (splitRouteChunks) {
248
+ if (route.isRoot) {
249
+ rootLayoutCode = `import RootLayout from '${route._component}'`;
250
+ component = `RootLayout`;
251
+ } else if (ssrMode === "string") {
252
+ lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
253
+ component = `loadable(${lazyImport})`;
254
+ } else {
255
+ lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
256
+ component = `lazy(${lazyImport})`;
257
+ }
251
258
  } else {
252
- lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
253
- component = `lazy(${lazyImport})`;
259
+ components.push(route._component);
260
+ component = `component_${components.length - 1}`;
254
261
  }
255
262
  }
256
263
  } else if (route._component) {
257
- lazyImport = `() => import('${route._component}')`;
258
- component = `loadable(${lazyImport})`;
264
+ if (splitRouteChunks) {
265
+ lazyImport = `() => import('${route._component}')`;
266
+ component = `loadable(${lazyImport})`;
267
+ } else {
268
+ components.push(route._component);
269
+ component = `component_${components.length - 1}`;
270
+ }
259
271
  }
260
272
  const finalRoute = {
261
273
  ...route,
@@ -276,20 +288,38 @@ const fileSystemRoutes = async ({
276
288
  for (const route of routes) {
277
289
  if ("type" in route) {
278
290
  const newRoute = traverseRouteTree(route);
279
- routeComponentsCode += `${JSON.stringify(newRoute, null, 2).replace(/"(loadable.*\))"/g, "$1").replace(/"(loadableLazy.*\))"/g, "$1").replace(/"(\(\)[^,]+)",/g, "$1,").replace(/"(lazy\(.*\))"/g, "$1").replace(/"(loading_[^"]+)"/g, "$1").replace(/"(loader_[^"]+)"/g, "$1").replace(/"(RootLayout)"/g, "$1").replace(/"(error_[^"]+)"/g, "$1").replace(/\\"/g, '"')},`;
291
+ const routeStr = JSON.stringify(newRoute, null, 2);
292
+ const keywords = [
293
+ "component",
294
+ "lazyImport",
295
+ "loader",
296
+ "loading",
297
+ "error"
298
+ ];
299
+ const regs = keywords.map(createMatchReg);
300
+ const newRouteStr = regs.reduce((acc, reg) => acc.replace(reg, "$1$2"), routeStr).replace(/"(RootLayout)"/g, "$1").replace(/\\"/g, '"');
301
+ routeComponentsCode += `${newRouteStr},`;
280
302
  } else {
281
303
  const component = `loadable(() => import('${route._component}'))`;
282
304
  const finalRoute = {
283
305
  ...route,
284
306
  component
285
307
  };
286
- routeComponentsCode += `${JSON.stringify(finalRoute, null, 2).replace(/"(loadable[^"]*)"/g, "$1").replace(/"(lazy[^"]*)"/g, "$1")},`;
308
+ const keywords = ["component", "lazyImport"];
309
+ const routeStr = JSON.stringify(finalRoute, null, 2);
310
+ const regs = keywords.map(createMatchReg);
311
+ const newRouteStr = regs.reduce((acc, reg) => acc.replace(reg, "$1$2"), routeStr).replace(/\\"/g, '"');
312
+ routeComponentsCode += `${newRouteStr},`;
287
313
  }
288
314
  }
289
315
  routeComponentsCode += `
290
316
  ];`;
291
317
  const importLoadingCode = loadings.map((loading, index2) => {
292
318
  return `import loading_${index2} from '${loading}';
319
+ `;
320
+ }).join("");
321
+ const importComponentsCode = components.map((component, index2) => {
322
+ return `import component_${index2} from '${component}';
293
323
  `;
294
324
  }).join("");
295
325
  const importErrorComponentsCode = errors.map((error, index2) => {
@@ -314,6 +344,7 @@ const fileSystemRoutes = async ({
314
344
  await import_utils.fs.writeJSON(loadersMapFile, loadersMap);
315
345
  return `
316
346
  ${importLazyCode}
347
+ ${importComponentsCode}
317
348
  ${rootLayoutCode}
318
349
  ${importLoadingCode}
319
350
  ${importErrorComponentsCode}
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
  var builder_rspack_exports = {};
19
29
  __export(builder_rspack_exports, {
@@ -23,7 +33,18 @@ module.exports = __toCommonJS(builder_rspack_exports);
23
33
  var import_builder_rspack_provider = require("@modern-js/builder-rspack-provider");
24
34
  var import_generator = require("../generator");
25
35
  function createRspackBuilderForModern(options) {
26
- return (0, import_generator.generateBuilder)(options, import_builder_rspack_provider.builderRspackProvider);
36
+ return (0, import_generator.generateBuilder)(options, import_builder_rspack_provider.builderRspackProvider, {
37
+ async modifyBuilderInstance(builder) {
38
+ applyBuilderPlugins(builder, options);
39
+ }
40
+ });
41
+ }
42
+ async function applyBuilderPlugins(builder, options) {
43
+ const { normalizedConfig } = options;
44
+ if (!normalizedConfig.output.disableNodePolyfill) {
45
+ const { builderPluginNodePolyfill } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-node-polyfill")));
46
+ builder.addPlugins([builderPluginNodePolyfill()]);
47
+ }
27
48
  }
28
49
  // Annotate the CommonJS export names for ESM import in node:
29
50
  0 && (module.exports = {
@@ -42,13 +42,16 @@ const builderPluginAdapterSSR = (options) => ({
42
42
  api.modifyBundlerChain(
43
43
  async (chain, { target, CHAIN_ID, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
44
44
  const builderConfig = api.getNormalizedConfig();
45
- applyRouterPlugin(chain, options);
46
- await applySSRLoaderEntry(chain, options, isServer);
45
+ const { normalizedConfig: normalizedConfig2 } = options;
46
+ if ((0, import_utils.isSSR)(normalizedConfig2)) {
47
+ applyRouterPlugin(chain, options);
48
+ await applySSRLoaderEntry(chain, options, isServer);
49
+ }
47
50
  if (["node", "service-worker"].includes(target)) {
48
51
  applyFilterEntriesBySSRConfig({
49
52
  isProd,
50
53
  chain,
51
- appNormalizedConfig: options.normalizedConfig
54
+ appNormalizedConfig: normalizedConfig2
52
55
  });
53
56
  }
54
57
  if ((0, import_adapterHtml.isHtmlEnabled)(builderConfig, target)) {
@@ -62,6 +62,9 @@ class RouterPlugin {
62
62
  },
63
63
  async () => {
64
64
  const stats = compilation.getStats().toJson({
65
+ all: false,
66
+ publicPath: true,
67
+ assets: true,
65
68
  chunkGroups: true,
66
69
  chunks: true
67
70
  });
@@ -245,7 +245,7 @@ var generateCode = function() {
245
245
  }
246
246
  function _generateEntryCode() {
247
247
  _generateEntryCode = _asyncToGenerator(function(entrypoint) {
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;
248
+ var entryName, isAutoMount, customBootstrap, fileSystemRoutes, _config2_output, 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:
@@ -322,7 +322,8 @@ var generateCode = function() {
322
322
  ssrMode: useSSG ? "string" : mode,
323
323
  nestedRoutesEntry: entrypoint.nestedRoutesEntry,
324
324
  entryName: entrypoint.entryName,
325
- internalDirectory: internalDirectory
325
+ internalDirectory: internalDirectory,
326
+ splitRouteChunks: config2 === null || config2 === void 0 ? void 0 : (_config2_output = config2.output) === null || _config2_output === void 0 ? void 0 : _config2_output.splitRouteChunks
326
327
  })
327
328
  ];
328
329
  case 4:
@@ -638,6 +638,14 @@ var analyze_default = function(param) {
638
638
  });
639
639
  })();
640
640
  },
641
+ validateSchema: function validateSchema() {
642
+ return {
643
+ target: "output.splitRouteChunks",
644
+ schema: {
645
+ type: "boolean"
646
+ }
647
+ };
648
+ },
641
649
  fileChange: function fileChange(e) {
642
650
  return _asyncToGenerator(function() {
643
651
  var appContext, appDirectory, filename, eventType, isPageFile, absoluteFilePath, isRouteComponent, resolvedConfig, generateCode, entrypoints;
@@ -237,7 +237,7 @@ var renderFunction = function(param) {
237
237
  }).join("\n"), "\n ]\n })(").concat(fileSystemRoutes2 ? "" : "App", ")\n\n\n if(!AppWrapper.init && typeof appInit !== 'undefined') {\n AppWrapper.init = appInit;\n }\n\n\n if (IS_BROWSER) {\n ").concat(customBootstrap ? "customBootstrap(AppWrapper, () => ".concat(bootstrap, ");") : "".concat(bootstrap, ";"), "\n }\n\n return AppWrapper\n");
238
238
  };
239
239
  var html = function(partials) {
240
- return "\n<!DOCTYPE html>\n<html>\n<head>\n <%= meta %>\n <title><%= title %></title>\n\n ".concat(partials.top.join("\n"), "\n\n <script>\n window.__assetPrefix__ = '<%= assetPrefix %>';\n </script>\n ").concat(partials.head.join("\n"), "\n\n</head>\n\n<body>\n <!--<?- chunksMap.css ?>-->\n <noscript>\n We're sorry but react app doesn't work properly without JavaScript enabled. Please enable it to continue.\n </noscript>\n <div id=\"<%= mountId %>\"><!--<?- html ?>--></div>\n ").concat(partials.body.join("\n"), "\n <!--<?- chunksMap.js ?>-->\n <!--<?- SSRDataScript ?>-->\n <!--<?- bottomTemplate ?>-->\n</body>\n\n</html>\n");
240
+ return "\n<!DOCTYPE html>\n<html>\n<head>\n <%= meta %>\n <title><%= title %></title>\n\n ".concat(partials.top.join("\n"), "\n\n <script>\n window.__assetPrefix__ = '<%= assetPrefix %>';\n </script>\n ").concat(partials.head.join("\n"), "\n\n</head>\n\n<body>\n <noscript>\n We're sorry but react app doesn't work properly without JavaScript enabled. Please enable it to continue.\n </noscript>\n <div id=\"<%= mountId %>\"><!--<?- html ?>--></div>\n ").concat(partials.body.join("\n"), "\n <!--<?- chunksMap.js ?>-->\n <!--<?- SSRDataScript ?>-->\n <!--<?- bottomTemplate ?>-->\n</body>\n\n</html>\n");
241
241
  };
242
242
  var routesForServer = function(param) {
243
243
  var routes = param.routes;
@@ -296,13 +296,17 @@ var routesForServer = function(param) {
296
296
  }
297
297
  return "\n ".concat(importLoadersCode, "\n ").concat(routesCode, "\n ");
298
298
  };
299
+ var createMatchReg = function(keyword) {
300
+ return new RegExp('("'.concat(keyword, '":\\s)"([^,]+)"'), "g");
301
+ };
299
302
  var fileSystemRoutes = function() {
300
303
  var _ref = _asyncToGenerator(function(param) {
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;
304
+ var routes, ssrMode, nestedRoutesEntry, entryName, internalDirectory, _param_splitRouteChunks, splitRouteChunks, components, loadings, errors, loaders, loadersMap, loadersMapFile, importLazyCode, rootLayoutCode, getDataLoaderPath, traverseRouteTree, routeComponentsCode, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, route, newRoute, routeStr, keywords, regs, newRouteStr, component, finalRoute, keywords1, routeStr1, regs1, newRouteStr1, importLoadingCode, importComponentsCode, importErrorComponentsCode, importLoadersCode, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, key, loaderInfo;
302
305
  return __generator(this, function(_state) {
303
306
  switch(_state.label){
304
307
  case 0:
305
- routes = param.routes, ssrMode = param.ssrMode, nestedRoutesEntry = param.nestedRoutesEntry, entryName = param.entryName, internalDirectory = param.internalDirectory;
308
+ routes = param.routes, ssrMode = param.ssrMode, nestedRoutesEntry = param.nestedRoutesEntry, entryName = param.entryName, internalDirectory = param.internalDirectory, _param_splitRouteChunks = param.splitRouteChunks, splitRouteChunks = _param_splitRouteChunks === void 0 ? true : _param_splitRouteChunks;
309
+ components = [];
306
310
  loadings = [];
307
311
  errors = [];
308
312
  loaders = [];
@@ -351,20 +355,30 @@ var fileSystemRoutes = function() {
351
355
  };
352
356
  }
353
357
  if (route._component) {
354
- if (route.isRoot) {
355
- rootLayoutCode = "import RootLayout from '".concat(route._component, "'");
356
- component = "RootLayout";
357
- } else if (ssrMode === "string") {
358
- lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, "\" */ '").concat(route._component, "')");
359
- component = "loadable(".concat(lazyImport, ")");
358
+ if (splitRouteChunks) {
359
+ if (route.isRoot) {
360
+ rootLayoutCode = "import RootLayout from '".concat(route._component, "'");
361
+ component = "RootLayout";
362
+ } else if (ssrMode === "string") {
363
+ lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, "\" */ '").concat(route._component, "')");
364
+ component = "loadable(".concat(lazyImport, ")");
365
+ } else {
366
+ lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, "\" */ '").concat(route._component, "')");
367
+ component = "lazy(".concat(lazyImport, ")");
368
+ }
360
369
  } else {
361
- lazyImport = '() => import(/* webpackChunkName: "'.concat(route.id, "\" */ '").concat(route._component, "')");
362
- component = "lazy(".concat(lazyImport, ")");
370
+ components.push(route._component);
371
+ component = "component_".concat(components.length - 1);
363
372
  }
364
373
  }
365
374
  } else if (route._component) {
366
- lazyImport = "() => import('".concat(route._component, "')");
367
- component = "loadable(".concat(lazyImport, ")");
375
+ if (splitRouteChunks) {
376
+ lazyImport = "() => import('".concat(route._component, "')");
377
+ component = "loadable(".concat(lazyImport, ")");
378
+ } else {
379
+ components.push(route._component);
380
+ component = "component_".concat(components.length - 1);
381
+ }
368
382
  }
369
383
  var finalRoute = _objectSpreadProps(_objectSpread({}, route), {
370
384
  lazyImport: lazyImport,
@@ -385,13 +399,34 @@ var fileSystemRoutes = function() {
385
399
  route = _step.value;
386
400
  if ("type" in route) {
387
401
  newRoute = traverseRouteTree(route);
388
- routeComponentsCode += "".concat(JSON.stringify(newRoute, null, 2).replace(/"(loadable.*\))"/g, "$1").replace(/"(loadableLazy.*\))"/g, "$1").replace(/"(\(\)[^,]+)",/g, "$1,").replace(/"(lazy\(.*\))"/g, "$1").replace(/"(loading_[^"]+)"/g, "$1").replace(/"(loader_[^"]+)"/g, "$1").replace(/"(RootLayout)"/g, "$1").replace(/"(error_[^"]+)"/g, "$1").replace(/\\"/g, '"'), ",");
402
+ routeStr = JSON.stringify(newRoute, null, 2);
403
+ keywords = [
404
+ "component",
405
+ "lazyImport",
406
+ "loader",
407
+ "loading",
408
+ "error"
409
+ ];
410
+ regs = keywords.map(createMatchReg);
411
+ newRouteStr = regs.reduce(function(acc, reg) {
412
+ return acc.replace(reg, "$1$2");
413
+ }, routeStr).replace(/"(RootLayout)"/g, "$1").replace(/\\"/g, '"');
414
+ routeComponentsCode += "".concat(newRouteStr, ",");
389
415
  } else {
390
416
  component = "loadable(() => import('".concat(route._component, "'))");
391
417
  finalRoute = _objectSpreadProps(_objectSpread({}, route), {
392
418
  component: component
393
419
  });
394
- routeComponentsCode += "".concat(JSON.stringify(finalRoute, null, 2).replace(/"(loadable[^"]*)"/g, "$1").replace(/"(lazy[^"]*)"/g, "$1"), ",");
420
+ keywords1 = [
421
+ "component",
422
+ "lazyImport"
423
+ ];
424
+ routeStr1 = JSON.stringify(finalRoute, null, 2);
425
+ regs1 = keywords1.map(createMatchReg);
426
+ newRouteStr1 = regs1.reduce(function(acc, reg) {
427
+ return acc.replace(reg, "$1$2");
428
+ }, routeStr1).replace(/\\"/g, '"');
429
+ routeComponentsCode += "".concat(newRouteStr1, ",");
395
430
  }
396
431
  }
397
432
  } catch (err) {
@@ -412,6 +447,9 @@ var fileSystemRoutes = function() {
412
447
  importLoadingCode = loadings.map(function(loading, index2) {
413
448
  return "import loading_".concat(index2, " from '").concat(loading, "';\n");
414
449
  }).join("");
450
+ importComponentsCode = components.map(function(component, index2) {
451
+ return "import component_".concat(index2, " from '").concat(component, "';\n");
452
+ }).join("");
415
453
  importErrorComponentsCode = errors.map(function(error, index2) {
416
454
  return "import error_".concat(index2, " from '").concat(error, "';\n");
417
455
  }).join("");
@@ -454,7 +492,7 @@ var fileSystemRoutes = function() {
454
492
  _state.sent();
455
493
  return [
456
494
  2,
457
- "\n ".concat(importLazyCode, "\n ").concat(rootLayoutCode, "\n ").concat(importLoadingCode, "\n ").concat(importErrorComponentsCode, "\n ").concat(importLoadersCode, "\n ").concat(routeComponentsCode, "\n ")
495
+ "\n ".concat(importLazyCode, "\n ").concat(importComponentsCode, "\n ").concat(rootLayoutCode, "\n ").concat(importLoadingCode, "\n ").concat(importErrorComponentsCode, "\n ").concat(importLoadersCode, "\n ").concat(routeComponentsCode, "\n ")
458
496
  ];
459
497
  }
460
498
  });