@modern-js/app-tools 3.9.2 → 3.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 (311) hide show
  1. package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +54 -2
  2. package/dist/cjs/commands/build.js +1 -2
  3. package/dist/cjs/commands/deploy.js +1 -3
  4. package/dist/cjs/commands/index.js +4 -0
  5. package/dist/cjs/compat/hooks.js +0 -5
  6. package/dist/cjs/compat/index.js +0 -5
  7. package/dist/cjs/compat/utils.js +0 -5
  8. package/dist/cjs/index.js +15 -39
  9. package/dist/cjs/plugins/analyze/index.js +2 -2
  10. package/dist/cjs/plugins/analyze/utils.js +2 -3
  11. package/dist/cjs/plugins/initialize/index.js +3 -5
  12. package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.mjs +54 -2
  13. package/dist/esm/commands/build.mjs +1 -2
  14. package/dist/esm/commands/deploy.mjs +1 -3
  15. package/dist/esm/commands/index.mjs +4 -0
  16. package/dist/esm/compat/hooks.mjs +0 -5
  17. package/dist/esm/compat/index.mjs +0 -5
  18. package/dist/esm/compat/utils.mjs +0 -5
  19. package/dist/esm/index.mjs +2 -10
  20. package/dist/esm/plugins/analyze/index.mjs +2 -2
  21. package/dist/esm/plugins/analyze/utils.mjs +2 -3
  22. package/dist/esm/plugins/initialize/index.mjs +3 -5
  23. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.mjs +54 -2
  24. package/dist/esm-node/commands/build.mjs +1 -2
  25. package/dist/esm-node/commands/deploy.mjs +1 -3
  26. package/dist/esm-node/commands/index.mjs +4 -0
  27. package/dist/esm-node/compat/hooks.mjs +0 -5
  28. package/dist/esm-node/compat/index.mjs +0 -5
  29. package/dist/esm-node/compat/utils.mjs +0 -5
  30. package/dist/esm-node/index.mjs +2 -10
  31. package/dist/esm-node/plugins/analyze/index.mjs +2 -2
  32. package/dist/esm-node/plugins/analyze/utils.mjs +2 -3
  33. package/dist/esm-node/plugins/initialize/index.mjs +3 -5
  34. package/dist/types/index.d.ts +1 -3
  35. package/dist/types/plugins/analyze/utils.d.ts +1 -1
  36. package/dist/types/types/config/index.d.ts +0 -2
  37. package/dist/types/types/config/tools.d.ts +0 -8
  38. package/docs/apis/app/commands.md +2 -0
  39. package/docs/apis/app/hooks/api/lambda.md +2 -0
  40. package/docs/apis/app/hooks/config/favicon.md +2 -0
  41. package/docs/apis/app/hooks/config/html.md +2 -0
  42. package/docs/apis/app/hooks/config/icon.md +2 -0
  43. package/docs/apis/app/hooks/config/mock.md +2 -0
  44. package/docs/apis/app/hooks/config/public.md +2 -0
  45. package/docs/apis/app/hooks/config/upload.md +3 -3
  46. package/docs/apis/app/hooks/modern-config.md +2 -0
  47. package/docs/apis/app/hooks/server/server.md +2 -0
  48. package/docs/apis/app/hooks/shared.md +2 -0
  49. package/docs/apis/app/hooks/src/app.md +2 -0
  50. package/docs/apis/app/hooks/src/entry.md +2 -0
  51. package/docs/apis/app/hooks/src/entry.server.md +2 -0
  52. package/docs/apis/app/hooks/src/modern.runtime.md +2 -0
  53. package/docs/apis/app/hooks/src/routes.md +2 -0
  54. package/docs/apis/app/hooks/src/server.md +2 -0
  55. package/docs/apis/app/runtime/bff/use-hono-context.md +2 -0
  56. package/docs/apis/app/runtime/core/create-root.md +5 -1
  57. package/docs/apis/app/runtime/core/render.md +7 -2
  58. package/docs/apis/app/runtime/core/runtime-context.md +18 -16
  59. package/docs/apis/app/runtime/router/router.md +11 -6
  60. package/docs/apis/app/runtime/ssr/no-ssr.md +2 -0
  61. package/docs/apis/app/runtime/ssr/renderStreaming.md +2 -0
  62. package/docs/apis/app/runtime/ssr/renderString.md +2 -0
  63. package/docs/apis/app/runtime/ssr/requestHandler.md +2 -0
  64. package/docs/apis/app/runtime/utility/css-in-js.md +2 -0
  65. package/docs/apis/app/runtime/utility/head.md +2 -0
  66. package/docs/apis/app/runtime/utility/loadable.md +2 -0
  67. package/docs/community/blog/2022-0708-updates.md +2 -0
  68. package/docs/community/blog/2022-0910-updates.md +2 -0
  69. package/docs/community/blog/overview.md +2 -0
  70. package/docs/community/blog/v2-release-note.md +2 -0
  71. package/docs/community/blog/v3-release-note.md +18 -13
  72. package/docs/community/contributing-guide.md +17 -33
  73. package/docs/community/releases.md +2 -0
  74. package/docs/community/showcase.md +2 -0
  75. package/docs/community/team.md +2 -0
  76. package/docs/configure/app/bff/cross-project.md +2 -0
  77. package/docs/configure/app/bff/prefix.md +2 -0
  78. package/docs/configure/app/builder-plugins.md +2 -0
  79. package/docs/configure/app/dev/asset-prefix.md +2 -0
  80. package/docs/configure/app/dev/before-start-url.md +2 -0
  81. package/docs/configure/app/dev/client.md +2 -0
  82. package/docs/configure/app/dev/hmr.md +2 -0
  83. package/docs/configure/app/dev/host.md +2 -0
  84. package/docs/configure/app/dev/https.md +2 -0
  85. package/docs/configure/app/dev/lazy-compilation.md +19 -1
  86. package/docs/configure/app/dev/live-reload.md +2 -0
  87. package/docs/configure/app/dev/mock-dir.md +2 -0
  88. package/docs/configure/app/dev/progress-bar.md +2 -0
  89. package/docs/configure/app/dev/server.md +2 -0
  90. package/docs/configure/app/dev/setup-middlewares.md +2 -0
  91. package/docs/configure/app/dev/start-url.md +2 -0
  92. package/docs/configure/app/dev/watch-files.md +2 -0
  93. package/docs/configure/app/dev/write-to-disk.md +2 -0
  94. package/docs/configure/app/experiments/source-build.md +2 -0
  95. package/docs/configure/app/html/app-icon.md +2 -0
  96. package/docs/configure/app/html/crossorigin.md +2 -0
  97. package/docs/configure/app/html/favicon.md +2 -0
  98. package/docs/configure/app/html/inject.md +2 -0
  99. package/docs/configure/app/html/meta.md +2 -0
  100. package/docs/configure/app/html/mount-id.md +2 -0
  101. package/docs/configure/app/html/output-structure.md +2 -0
  102. package/docs/configure/app/html/script-loading.md +2 -0
  103. package/docs/configure/app/html/tags.md +2 -0
  104. package/docs/configure/app/html/template-parameters.md +2 -0
  105. package/docs/configure/app/html/template.md +2 -0
  106. package/docs/configure/app/html/title.md +2 -0
  107. package/docs/configure/app/output/asset-prefix.md +2 -0
  108. package/docs/configure/app/output/assets-retry.md +2 -0
  109. package/docs/configure/app/output/charset.md +2 -0
  110. package/docs/configure/app/output/clean-dist-path.md +2 -0
  111. package/docs/configure/app/output/convert-to-rem.md +2 -0
  112. package/docs/configure/app/output/copy.md +2 -0
  113. package/docs/configure/app/output/css-modules.md +3 -5
  114. package/docs/configure/app/output/data-uri-limit.md +2 -0
  115. package/docs/configure/app/output/disable-css-module-extension.md +2 -0
  116. package/docs/configure/app/output/disable-inline-runtime-chunk.md +2 -0
  117. package/docs/configure/app/output/disable-svgr.md +6 -0
  118. package/docs/configure/app/output/disable-ts-checker.md +2 -0
  119. package/docs/configure/app/output/dist-path.md +2 -0
  120. package/docs/configure/app/output/enable-asset-manifest.md +2 -0
  121. package/docs/configure/app/output/enable-css-module-tsdeclaration.md +2 -0
  122. package/docs/configure/app/output/enable-inline-route-manifests.md +2 -0
  123. package/docs/configure/app/output/externals.md +2 -0
  124. package/docs/configure/app/output/filename-hash.md +2 -0
  125. package/docs/configure/app/output/filename.md +2 -0
  126. package/docs/configure/app/output/inject-styles.md +2 -0
  127. package/docs/configure/app/output/inline-scripts.md +3 -2
  128. package/docs/configure/app/output/inline-styles.md +3 -2
  129. package/docs/configure/app/output/legal-comments.md +2 -0
  130. package/docs/configure/app/output/minify.md +2 -0
  131. package/docs/configure/app/output/override-browserslist.md +2 -0
  132. package/docs/configure/app/output/polyfill.md +2 -0
  133. package/docs/configure/app/output/source-map.md +2 -0
  134. package/docs/configure/app/output/split-route-chunks.md +3 -1
  135. package/docs/configure/app/output/ssg.md +2 -0
  136. package/docs/configure/app/output/ssgByEntries.md +2 -0
  137. package/docs/configure/app/output/svg-default-export.md +6 -0
  138. package/docs/configure/app/output/temp-dir.md +2 -0
  139. package/docs/configure/app/performance/build-cache.md +2 -0
  140. package/docs/configure/app/performance/chunk-split.md +3 -4
  141. package/docs/configure/app/performance/dns-prefetch.md +2 -0
  142. package/docs/configure/app/performance/preconnect.md +2 -0
  143. package/docs/configure/app/performance/prefetch.md +2 -0
  144. package/docs/configure/app/performance/preload.md +2 -0
  145. package/docs/configure/app/performance/print-file-size.md +2 -0
  146. package/docs/configure/app/performance/profile.md +2 -0
  147. package/docs/configure/app/performance/remove-console.md +2 -0
  148. package/docs/configure/app/performance/remove-moment-locale.md +2 -0
  149. package/docs/configure/app/plugins.md +2 -0
  150. package/docs/configure/app/resolve/alias-strategy.md +2 -0
  151. package/docs/configure/app/resolve/alias.md +2 -0
  152. package/docs/configure/app/resolve/condition-names.md +2 -0
  153. package/docs/configure/app/resolve/dedupe.md +2 -0
  154. package/docs/configure/app/resolve/extensions.md +2 -0
  155. package/docs/configure/app/runtime/0-intro.md +2 -0
  156. package/docs/configure/app/runtime/plugins.md +8 -4
  157. package/docs/configure/app/runtime/router.md +2 -0
  158. package/docs/configure/app/security/check-syntax.md +2 -0
  159. package/docs/configure/app/security/nonce.md +2 -0
  160. package/docs/configure/app/security/sri.md +2 -0
  161. package/docs/configure/app/server/base-url.md +2 -0
  162. package/docs/configure/app/server/port.md +2 -0
  163. package/docs/configure/app/server/public-routes.md +2 -0
  164. package/docs/configure/app/server/routes.md +2 -0
  165. package/docs/configure/app/server/rsc.md +2 -0
  166. package/docs/configure/app/server/ssr-by-entries.md +2 -0
  167. package/docs/configure/app/server/ssr.md +3 -1
  168. package/docs/configure/app/server/tsconfig-path.md +4 -2
  169. package/docs/configure/app/source/alias-strategy.md +2 -0
  170. package/docs/configure/app/source/alias.md +2 -0
  171. package/docs/configure/app/source/config-dir.md +2 -0
  172. package/docs/configure/app/source/decorators.md +2 -0
  173. package/docs/configure/app/source/define.md +2 -0
  174. package/docs/configure/app/source/disable-default-entries.md +2 -0
  175. package/docs/configure/app/source/enable-async-entry.md +2 -0
  176. package/docs/configure/app/source/enable-async-pre-entry.md +2 -0
  177. package/docs/configure/app/source/entries-dir.md +2 -0
  178. package/docs/configure/app/source/entries.md +2 -0
  179. package/docs/configure/app/source/exclude.md +2 -0
  180. package/docs/configure/app/source/global-vars.md +2 -0
  181. package/docs/configure/app/source/include.md +2 -0
  182. package/docs/configure/app/source/main-entry-name.md +2 -0
  183. package/docs/configure/app/source/pre-entry.md +2 -0
  184. package/docs/configure/app/source/react-compiler.md +2 -0
  185. package/docs/configure/app/source/transform-import.md +2 -0
  186. package/docs/configure/app/split-chunks.md +2 -0
  187. package/docs/configure/app/tools/autoprefixer.md +2 -0
  188. package/docs/configure/app/tools/bundler-chain.md +2 -0
  189. package/docs/configure/app/tools/css-extract.md +2 -0
  190. package/docs/configure/app/tools/css-loader.md +2 -0
  191. package/docs/configure/app/tools/dev-server.md +2 -0
  192. package/docs/configure/app/tools/html-plugin.md +2 -0
  193. package/docs/configure/app/tools/less.md +96 -19
  194. package/docs/configure/app/tools/lightningcss-loader.md +2 -0
  195. package/docs/configure/app/tools/minify-css.md +2 -0
  196. package/docs/configure/app/tools/postcss.md +2 -0
  197. package/docs/configure/app/tools/rspack.md +2 -0
  198. package/docs/configure/app/tools/sass.md +89 -18
  199. package/docs/configure/app/tools/style-loader.md +2 -0
  200. package/docs/configure/app/tools/svgr.md +91 -0
  201. package/docs/configure/app/tools/swc.md +2 -0
  202. package/docs/configure/app/tools/ts-checker.md +2 -0
  203. package/docs/configure/app/usage.md +3 -5
  204. package/docs/guides/advanced-features/bff/cross-project.md +6 -4
  205. package/docs/guides/advanced-features/bff/extend-server.md +2 -0
  206. package/docs/guides/advanced-features/bff/frameworks.md +2 -0
  207. package/docs/guides/advanced-features/bff/function.md +2 -0
  208. package/docs/guides/advanced-features/bff/operators.md +2 -0
  209. package/docs/guides/advanced-features/bff/sdk.md +2 -0
  210. package/docs/guides/advanced-features/bff/upload.md +2 -0
  211. package/docs/guides/advanced-features/bff.md +2 -0
  212. package/docs/guides/advanced-features/build-performance.md +2 -0
  213. package/docs/guides/advanced-features/compatibility.md +2 -0
  214. package/docs/guides/advanced-features/international/advanced.md +3 -1
  215. package/docs/guides/advanced-features/international/api.md +21 -13
  216. package/docs/guides/advanced-features/international/best-practices.md +17 -15
  217. package/docs/guides/advanced-features/international/configuration.md +3 -1
  218. package/docs/guides/advanced-features/international/locale-detection.md +15 -4
  219. package/docs/guides/advanced-features/international/quick-start.md +2 -0
  220. package/docs/guides/advanced-features/international/resource-loading.md +11 -7
  221. package/docs/guides/advanced-features/international/routing.md +5 -1
  222. package/docs/guides/advanced-features/international.md +2 -0
  223. package/docs/guides/advanced-features/low-level.md +2 -0
  224. package/docs/guides/advanced-features/page-performance/code-split.md +2 -0
  225. package/docs/guides/advanced-features/page-performance/inline-assets.md +2 -0
  226. package/docs/guides/advanced-features/page-performance/optimize-bundle.md +2 -0
  227. package/docs/guides/advanced-features/page-performance/react-compiler.md +2 -0
  228. package/docs/guides/advanced-features/server-monitor/logger.md +2 -0
  229. package/docs/guides/advanced-features/server-monitor/metrics.md +2 -0
  230. package/docs/guides/advanced-features/server-monitor/monitors.md +3 -3
  231. package/docs/guides/advanced-features/source-build.md +3 -1
  232. package/docs/guides/advanced-features/web-server.md +5 -3
  233. package/docs/guides/basic-features/alias.md +2 -0
  234. package/docs/guides/basic-features/css/css-in-js.md +2 -0
  235. package/docs/guides/basic-features/css/css-modules.md +2 -0
  236. package/docs/guides/basic-features/css/css.md +2 -0
  237. package/docs/guides/basic-features/css/tailwindcss.md +2 -0
  238. package/docs/guides/basic-features/data/data-cache.md +2 -0
  239. package/docs/guides/basic-features/data/data-fetch.md +3 -3
  240. package/docs/guides/basic-features/data/data-write.md +25 -28
  241. package/docs/guides/basic-features/debug/mock.md +4 -2
  242. package/docs/guides/basic-features/debug/proxy.md +2 -0
  243. package/docs/guides/basic-features/debug/rsdoctor.md +2 -0
  244. package/docs/guides/basic-features/debug/using-storybook.md +6 -4
  245. package/docs/guides/basic-features/deploy.md +2 -0
  246. package/docs/guides/basic-features/env-vars.md +2 -0
  247. package/docs/guides/basic-features/html.md +4 -3
  248. package/docs/guides/basic-features/output-files.md +3 -1
  249. package/docs/guides/basic-features/render/before-render.md +2 -0
  250. package/docs/guides/basic-features/render/overview.md +2 -0
  251. package/docs/guides/basic-features/render/rsc.md +12 -2
  252. package/docs/guides/basic-features/render/ssg.md +2 -0
  253. package/docs/guides/basic-features/render/ssr-cache.md +2 -0
  254. package/docs/guides/basic-features/render/ssr.md +10 -12
  255. package/docs/guides/basic-features/render/streaming-ssr.md +4 -1
  256. package/docs/guides/basic-features/routes/config-routes.md +54 -54
  257. package/docs/guides/basic-features/routes/routes.md +2 -0
  258. package/docs/guides/basic-features/static-assets/json-files.md +2 -0
  259. package/docs/guides/basic-features/static-assets/svg-assets.md +31 -17
  260. package/docs/guides/basic-features/static-assets/wasm-assets.md +2 -0
  261. package/docs/guides/basic-features/static-assets.md +2 -0
  262. package/docs/guides/basic-features/testing/playwright.md +8 -6
  263. package/docs/guides/basic-features/testing/rstest.md +7 -5
  264. package/docs/guides/concept/builder.md +2 -0
  265. package/docs/guides/concept/entries.md +2 -0
  266. package/docs/guides/concept/server.md +2 -0
  267. package/docs/guides/get-started/ai-coding-agents.md +5 -3
  268. package/docs/guides/get-started/glossary.md +2 -0
  269. package/docs/guides/get-started/introduction.md +2 -0
  270. package/docs/guides/get-started/quick-start.md +13 -5
  271. package/docs/guides/get-started/tech-stack.md +2 -0
  272. package/docs/guides/get-started/upgrade.md +2 -0
  273. package/docs/guides/topic-detail/module-federation/application.md +2 -0
  274. package/docs/guides/topic-detail/module-federation/deploy.md +4 -2
  275. package/docs/guides/topic-detail/module-federation/i18n.md +2 -0
  276. package/docs/guides/topic-detail/module-federation/introduce.md +2 -0
  277. package/docs/guides/topic-detail/module-federation/ssr.md +2 -0
  278. package/docs/guides/topic-detail/module-federation/usage.md +2 -0
  279. package/docs/guides/troubleshooting/builder.md +2 -0
  280. package/docs/guides/troubleshooting/cli.md +2 -0
  281. package/docs/guides/troubleshooting/dependencies.md +2 -0
  282. package/docs/guides/troubleshooting/hmr.md +2 -0
  283. package/docs/guides/upgrade/config.md +14 -0
  284. package/docs/guides/upgrade/entry.md +2 -0
  285. package/docs/guides/upgrade/other.md +2 -0
  286. package/docs/guides/upgrade/overview.md +2 -0
  287. package/docs/guides/upgrade/tailwindcss.md +2 -0
  288. package/docs/guides/upgrade/web-server.md +25 -6
  289. package/docs/index.md +2 -0
  290. package/docs/llms.txt +8 -7
  291. package/docs/plugin/cli-plugins/api.md +2 -0
  292. package/docs/plugin/cli-plugins/life-cycle.md +2 -0
  293. package/docs/plugin/introduction.md +12 -10
  294. package/docs/plugin/official/cli-plugins/plugin-bff.md +2 -0
  295. package/docs/plugin/official/cli-plugins/plugin-ssg.md +2 -0
  296. package/docs/plugin/official/cli-plugins/plugin-styled-components.md +2 -0
  297. package/docs/plugin/official/cli-plugins.md +2 -0
  298. package/docs/plugin/plugin-system.md +3 -3
  299. package/docs/plugin/runtime-plugins/api.md +2 -0
  300. package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
  301. package/docs/plugin/server-plugins/api.md +2 -0
  302. package/docs/plugin/server-plugins/life-cycle.md +2 -0
  303. package/docs/tutorials/examples/csr-auth.md +2 -0
  304. package/docs/tutorials/foundations/introduction.md +2 -0
  305. package/lib/types.d.ts +0 -1
  306. package/package.json +18 -19
  307. package/{rslib.config.mts → rstack.config.mts} +4 -4
  308. package/dist/cjs/types/config/testing.js +0 -18
  309. package/dist/esm/types/config/testing.mjs +0 -0
  310. package/dist/esm-node/types/config/testing.mjs +0 -1
  311. package/dist/types/types/config/testing.d.ts +0 -8
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Application-Level Modules
2
4
 
3
5
  Modern.js provides runtime APIs to quickly export application-level Module Federation modules from your application.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Deployment
2
4
 
3
5
  In general, when deploying a Module Federation application, there are two key points to consider:
@@ -63,9 +65,9 @@ At this point, the `publicPath` defined in the producer's build output `mf-manif
63
65
  "name": "remote",
64
66
  "publicPath": "https://my-remote-module/"
65
67
  },
66
- "shared": [ /* xxx */ ],
68
+ "shared": [/* xxx */],
67
69
  "remotes": [],
68
- "exposes": [ /* xxx */ ]
70
+ "exposes": [/* xxx */]
69
71
  }
70
72
  ```
71
73
 
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Integrating Internationalization
2
4
 
3
5
  Modern.js provides the **@modern-js/plugin-i18n** plugin to support internationalization. When using Module Federation, you need to provide corresponding i18n integration solutions for different scenarios (components or applications).
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Introduction
2
4
 
3
5
  Module Federation is an architectural pattern for dividing JavaScript applications, allowing you to share code and resources among multiple JavaScript applications.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Server-Side Rendering
2
4
 
3
5
  `@module-federation/modern-js-v3` offers powerful capabilities, enabling developers to easily combine Module Federation with server-side rendering (SSR) in Modern.js applications.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Getting Started
2
4
 
3
5
  To use Module Federation in Modern.js, we recommend using the official plugin `@module-federation/modern-js-v3`.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Build FAQ
2
4
 
3
5
  If you encounter any build-related issues, you can refer to the current document for troubleshooting.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # CLI FAQ
2
4
 
3
5
  ### Unable to pass command line arguments correctly when using pnpm?
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Dependencies FAQ
2
4
 
3
5
  ### How to check the actual installed version of a dependency in the project?
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # HMR FAQ
2
4
 
3
5
  ### How to troubleshooting HMR ineffective issues?
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Configuration Changes
2
4
 
3
5
  This document mainly introduces incompatible configuration changes and recommended migration methods when upgrading from Modern.js 2.0 to 3.0.
@@ -22,6 +24,18 @@ server: {
22
24
  }
23
25
  ```
24
26
 
27
+ ### dev.lazyCompilation
28
+
29
+ **Change**: The default value in development has changed. Pure CSR and streaming SSR applications enable lazy compilation by default with `{ imports: true, entries: false }`; applications using string SSR, RSC or SSG keep it disabled by default. This only affects development and does not change production build output.
30
+
31
+ **Migration Example**: To keep the 2.0 behavior, disable it explicitly:
32
+
33
+ ```typescript
34
+ dev: {
35
+ lazyCompilation: false;
36
+ }
37
+ ```
38
+
25
39
  ## html
26
40
 
27
41
  ### html.appIcon
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Entry Changes
2
4
 
3
5
  This chapter introduces changes related to page entries when upgrading from Modern.js 2.0 to 3.0.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Other Important Changes
2
4
 
3
5
  This document introduces other important incompatible changes and related migration instructions when upgrading from Modern.js 2.0 to 3.0.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Overview
2
4
 
3
5
  This guide will help you upgrade from Modern.js 2.0 to Modern.js 3.0.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Tailwind Plugin Changes
2
4
 
3
5
  Modern.js 3.0 recommends integrating Tailwind CSS through Rsbuild's native approach, no longer relying on the `@modern-js/plugin-tailwindcss` plugin, to fully utilize Rsbuild's more flexible configuration capabilities and better build experience.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Custom Web Server Changes
2
4
 
3
5
  This chapter covers upgrades for two types of legacy custom Server APIs:
@@ -21,7 +23,10 @@ These two approaches are mutually exclusive in the legacy version. When migratin
21
23
 
22
24
  ```typescript
23
25
  // Legacy - server/index.ts
24
- export const unstableMiddleware: UnstableMiddleware[] = [middleware1, middleware2];
26
+ export const unstableMiddleware: UnstableMiddleware[] = [
27
+ middleware1,
28
+ middleware2,
29
+ ];
25
30
 
26
31
  // New - server/modern.server.ts
27
32
  import { defineServerConfig } from '@modern-js/server-runtime';
@@ -38,13 +43,22 @@ export default defineServerConfig({
38
43
 
39
44
  ```typescript
40
45
  // Legacy
41
- import type { UnstableMiddleware, UnstableMiddlewareContext } from '@modern-js/server-runtime';
42
- const middleware: UnstableMiddleware = async (c: UnstableMiddlewareContext, next) => {
46
+ import type {
47
+ UnstableMiddleware,
48
+ UnstableMiddlewareContext,
49
+ } from '@modern-js/server-runtime';
50
+ const middleware: UnstableMiddleware = async (
51
+ c: UnstableMiddlewareContext,
52
+ next,
53
+ ) => {
43
54
  return c.response.raw('response'); // Will continue rendering even without calling next
44
55
  };
45
56
 
46
57
  // New
47
- import { defineServerConfig, type MiddlewareHandler } from '@modern-js/server-runtime';
58
+ import {
59
+ defineServerConfig,
60
+ type MiddlewareHandler,
61
+ } from '@modern-js/server-runtime';
48
62
  const middleware: MiddlewareHandler = async (c, next) => {
49
63
  await next(); // Must call
50
64
  return c.text('response');
@@ -88,7 +102,10 @@ export const afterRender = (ctx, next) => {
88
102
  };
89
103
 
90
104
  // New - server/modern.server.ts
91
- import { defineServerConfig, type MiddlewareHandler } from '@modern-js/server-runtime';
105
+ import {
106
+ defineServerConfig,
107
+ type MiddlewareHandler,
108
+ } from '@modern-js/server-runtime';
92
109
 
93
110
  const renderMiddleware: MiddlewareHandler = async (c, next) => {
94
111
  await next(); // Wait for page rendering first
@@ -104,6 +121,8 @@ const renderMiddleware: MiddlewareHandler = async (c, next) => {
104
121
  };
105
122
 
106
123
  export default defineServerConfig({
107
- renderMiddlewares: [{ name: 'custom-content-injection', handler: renderMiddleware }],
124
+ renderMiddlewares: [
125
+ { name: 'custom-content-injection', handler: renderMiddleware },
126
+ ],
108
127
  });
109
128
  ```
package/docs/index.md CHANGED
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  [NEWModern.js 3.0 is released!→](/community/blog/v3-release-note)
2
4
 
3
5
  # Modern.js 3.0A Progressive React Framework for modern web development
package/docs/llms.txt CHANGED
@@ -39,7 +39,7 @@
39
39
  - [Using Rsdoctor](/guides/basic-features/debug/rsdoctor.md): Rsdoctor is a Rspack build analysis tool. In Modern.js, we recommend using Rsdoctor to diagnose and analyze the build process and build outputs.
40
40
  - [Using Storybook](/guides/basic-features/debug/using-storybook.md): Storybook is a tool specifically designed for component debugging. It provides: A rich variety of debugging capabilitiesIntegration with some testing toolsReusable documentation contentSharing capabilitiesWorkflow automation
41
41
  - [Rstest](/guides/basic-features/testing/rstest.md): Rstest is a testing framework developed by the Rspack team and built on top of Rspack for fast test execution. This guide explains how to integrate Rstest with Modern.js for web app testing.
42
- - [Playwright](/guides/basic-features/testing/playwright.md): Playwright is a testing framework that allows you to run tests automatically in Chromium, Firefox, and WebKit environments using a single API. You can use it to write E2E tests. To use Playwright in Modern.js, you need to install the dependencies first. You can run the following commands: <PackageManagerTabs command={{ npm: "npm init playwright", yarn: "yarn create playwright", pnpm: "pnpm create playwright" }} /> The above commands will automatically install Playwright dependencies and help you install and configure it in your project through a series of prompts, including adding a playwright.config.ts file. After creating with the default configuration, you can see the following files in your project: This is the default test file. Now create some new pages and test them.
42
+ - [Playwright](/guides/basic-features/testing/playwright.md): Playwright is a testing framework that allows you to run tests automatically in Chromium, Firefox, and WebKit environments using a single API. You can use it to write E2E tests. To use Playwright in Modern.js, you need to install the dependencies first. You can run the following commands: <PackageManagerTabs command={{ npm: 'npm init playwright', yarn: 'yarn create playwright', pnpm: 'pnpm create playwright', }} /> The above commands will automatically install Playwright dependencies and help you install and configure it in your project through a series of prompts, including adding a playwright.config.ts file. After creating with the default configuration, you can see the following files in your project: This is the default test file. Now create some new pages and test them.
43
43
  - [Path Alias](/guides/basic-features/alias.md): Path aliases allow developers to define aliases for modules, making it easier to reference them in code. This can be useful when you want to use a short, easy-to-remember name for a module instead of a long, complex path. For example, if you frequently reference the src/common/request.ts module in your project, you can define an alias for it as @request and then use `` in your code instead of writing the full relative path every time. This also allows you to move the module to a different location without needing to update all the import statements in your code. In Modern.js, there are two ways to set up path aliases: Through the paths configuration in tsconfig.json.Through the source.alias configuration.
44
44
  - [Environment Variables](/guides/basic-features/env-vars.md): Modern.js provides support for environment variables, including built-in environment variables and custom environment variables.
45
45
  - [Output Files](/guides/basic-features/output-files.md): This chapter will introduces the directory structure of output files and how to control the output directory of different types of files.
@@ -99,7 +99,7 @@
99
99
  - [hmr](/configure/app/dev/hmr.md): Type: booleanDefault: true Whether to enable Hot Module Replacement.
100
100
  - [host](/configure/app/dev/host.md): Type: stringDefault: 0.0.0.0 Specify the host that the dev server listens to. By default, the dev server will listen to 0.0.0.0, which means listening to all network interfaces, including localhost and public network addresses. If you want the dev server to listen only on localhost, you can set it to:
101
101
  - [https](/configure/app/dev/https.md): Type: boolean | { key: string; cert: string }Default: false After configuring this option, you can enable HTTPS Dev Server, and disabling the HTTP Dev Server. HTTP: HTTPS: Automatically generate certificates You can directly set https to true, Modern.js will automatically generate the HTTPS certificate based on devcert. When using this method, you need to manually install the devcert dependency in your project: Then configure dev.https to true: The devcert has some limitations, it does not currently support IP addresses yet. Manually set the certificate You can also manually pass in the certificate and the private key required in the dev.https option. This parameter will be directly passed to the createServer method of the https module in Node.js. For details, please refer to https.createServer. Clean up cert cache The certificate created by devcert is saved in ~/Library/Application\ Support/devcert. You may do some cleanup if needed.
102
- - [lazyCompilation](/configure/app/dev/lazy-compilation.md): Type: Default: false Enable lazy compilation (compilation on demand), implemented based on Rspack's lazy compilation feature.
102
+ - [lazyCompilation](/configure/app/dev/lazy-compilation.md): Type: Default: depends on how the application renders:Pure CSR and streaming SSR applications: { imports: true, entries: false }, which compiles dynamic imports on demand;Applications using string SSR (including any entry in server.ssrByEntries using string SSR), RSC or SSG: false. Enable lazy compilation (compilation on demand), implemented based on Rspack's lazy compilation feature. This option only takes effect in the dev server and does not affect production build output. When enabled for streaming SSR applications, route components are still compiled eagerly so that first-screen JS/CSS injection stays correct. An explicitly configured dev.lazyCompilation always takes precedence over the default. To disable it:
103
103
  - [liveReload](/configure/app/dev/live-reload.md): Type: booleanDefault: true Whether to reload the page when source files are changed.
104
104
  - [mockDir](/configure/app/dev/mock-dir.md): Type: stringDefault: './config/mock' Sets the directory containing the Mock API entry file. Relative paths are resolved from the application directory, and absolute paths are also supported. Modern.js loads index.ts or index.js from this directory during development. For example, move the Mock API entry to mocks/index.ts: This is also useful in a monorepo when multiple applications share one Mock directory:
105
105
  - [progressBar](/configure/app/dev/progress-bar.md): Type: Default: true Whether to display progress bar during compilation.
@@ -128,13 +128,14 @@
128
128
  - [cssLoader](/configure/app/tools/css-loader.md): Type: Object | FunctionDefault: The config of css-loader can be modified through tools.cssLoader.
129
129
  - [devServer](/configure/app/tools/dev-server.md): Type: ObjectDefault: {} The config of DevServer can be modified through tools.devServer. Options compress Type: booleanDefault: true Whether to enable gzip compression for served static assets. If you want to disable the gzip compression, you can set compress to false: headers Type: Record<string, string>Default: undefined Adds headers to all responses. historyApiFallback Type: boolean | ConnectHistoryApiFallbackOptionsDefault: false The index.html page will likely have to be served in place of any 404 responses. Enable devServer.historyApiFallback by setting it to true: For more options and information, see the connect-history-api-fallback documentation. proxy Type: ProxyOptions[] | Record<string, string | ProxyOptions>Default: undefined Configure proxy rules for the dev server, and forward requests to the specified service. watch Type: booleanDefault: true Whether to watch files change in directories such as mock/, server/, api/.
130
130
  - [htmlPlugin](/configure/app/tools/html-plugin.md): Type: boolean | Object | FunctionDefault: The configs of html-rspack-plugin can be modified through tools.htmlPlugin.
131
- - [less](/configure/app/tools/less.md): Type: Object | FunctionDefault: You can modify the config of less-loader via tools.less. Object Type When tools.less is configured as Object type, it is merged with the default config through Object.assign in a shallow way. It should be noted that lessOptions is merged through deepMerge in a deep way. For example: Function Type When tools.less is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. The second parameter provides some utility functions that can be called directly. For example: Modifying Less Version In some scenarios, if you need to use a specific version of Less instead of the built-in Less v4 in Modern.js, you can install the desired Less version in your project and set it up using the implementation option of the less-loader. Util Function addExcludes Type: (excludes: RegExp | RegExp[]) => void Used to specify which files less-loader does not compile, You can pass in one or more regular expressions to match the path of less files, for example:
131
+ - [less](/configure/app/tools/less.md): Type: Object | FunctionDefault: tools.less modifies the options of @rsbuild/plugin-less. It accepts the full plugin options: Modifying less-loader options When lessLoaderOptions is an Object, it is merged with the default config through Object.assign in a shallow way. It should be noted that lessOptions is merged through deepMerge in a deep way. For example: When lessLoaderOptions is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. The second parameter provides some utility functions that can be called directly. For example: Parallel compilation Less compilation is pure JavaScript and runs on the Node.js main thread by default. With parallel enabled, Less modules are compiled in a pool of worker threads, which shortens the build when a project has many Less files. Modifying Less Version In some scenarios, if you need to use a specific version of Less instead of the built-in Less v4 in Modern.js, you can install the desired Less version in your project and set it up using the implementation option of the less-loader. Util Function addExcludes Type: (excludes: RegExp | RegExp[]) => void Used to specify which files less-loader does not compile, You can pass in one or more regular expressions to match the path of less files, for example: The plugin's exclude option is the recommended equivalent: Legacy form In earlier versions, tools.less took the less-loader options directly, e.g. tools.less: { lessOptions: {} } or tools.less(config, { addExcludes }) {}. This form still works: Modern.js wraps it into lessLoaderOptions and produces exactly the same config as before. A migration hint is printed in development, and the legacy form will be removed in the next major version.
132
132
  - [lightningcssLoader](/configure/app/tools/lightningcss-loader.md): Type: Rspack.LightningcssLoaderOptions | Function | booleanDefault: Rspack.LightningcssLoaderOptions | Function | boolean You can configure builtin:lightningcss-loader through tools.lightningcssLoader.
133
133
  - [minifyCss](/configure/app/tools/minify-css.md): Type: Object | Function | undefinedDefault: When building for production, Modern.js will minimize the CSS code through css-minimizer-webpack-plugin. The config of css-minimizer-webpack-plugin can be modified via tools.minifyCss. Object Type When tools.minifyCss is Object type, it will be merged with the default config via Object.assign. For example, modify the preset config of cssnano: Function Type When tools.minifyCss is Function type, the default config is passed in as the first parameter, the config object can be modified directly, or a value can be returned as the final result.
134
134
  - [postcss](/configure/app/tools/postcss.md): Type: Object | FunctionDefault: Modern.js integrates PostCSS by default, you can configure postcss-loader through tools.postcss. It should be noted that when you enable the tools.lightningcss configuration, PostCSS will be disabled by default, including postcss-loader and its default plugins.
135
135
  - [rspack](/configure/app/tools/rspack.md): Type: Rspack.Configuration | Function | undefinedDefault: undefined tools.rspack is used to configure Rspack.
136
- - [sass](/configure/app/tools/sass.md): Type: Object | FunctionDefault: You can modify the config of sass-loader via tools.sass. Object Type When tools.sass is Object type, it is merged with the default config through Object.assign. It should be noted that sassOptions is merged through deepMerge in a deep way. For example: Function Type When tools.sass is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. The second parameter provides some utility functions that can be called directly. For Example: Modifying Sass Version In some scenarios, if you need to use a specific version of Sass instead of the built-in Dart Sass v1 in Modern.js, you can install the desired Sass version in your project and set it up using the implementation option of the sass-loader. Utility Function addExcludes Type: (excludes: RegExp | RegExp[]) => void Used to specify which files sass-loader does not compile, You can pass in one or more regular expressions to match the path of sass files, for example:
136
+ - [sass](/configure/app/tools/sass.md): Type: Object | FunctionDefault: tools.sass modifies the options of @rsbuild/plugin-sass. It accepts the full plugin options: Modifying sass-loader options When sassLoaderOptions is an Object, it is merged with the default config through Object.assign in a shallow way. It should be noted that sassOptions is merged through deepMerge in a deep way. For example: When sassLoaderOptions is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. The second parameter provides some utility functions that can be called directly. For example: Disabling URL rewriting By default, relative URLs in Sass files are rewritten by resolve-url-loader so that they resolve relative to the source file. If your project does not rely on this, turn it off to drop one loader from the chain: Modifying Sass Version In some scenarios, if you need to use a specific version of Sass instead of the built-in Dart Sass v1 in Modern.js, you can install the desired Sass version in your project and set it up using the implementation option of the sass-loader. Util Function addExcludes Type: (excludes: RegExp | RegExp[]) => void Used to specify which files sass-loader does not compile, You can pass in one or more regular expressions to match the path of sass files, for example: The plugin's exclude option is the recommended equivalent: Legacy form In earlier versions, tools.sass took the sass-loader options directly, e.g. tools.sass: { sassOptions: {} } or tools.sass(config, { addExcludes }) {}. This form still works: Modern.js wraps it into sassLoaderOptions and produces exactly the same config as before. A migration hint is printed in development, and the legacy form will be removed in the next major version.
137
137
  - [styleLoader](/configure/app/tools/style-loader.md): Type: Object | FunctionDefault: {} The config of style-loader can be set through tools.styleLoader.
138
+ - [svgr](/configure/app/tools/svgr.md): Type: Object | Function | falseDefault: tools.svgr modifies the options of @rsbuild/plugin-svgr. It accepts the full plugin options. Set it to false to skip registering the SVGR plugin; all .svg files are then treated as static assets. Merge rules When tools.svgr is an Object, its top-level fields are merged with the defaults through Object.assign in a shallow way, and svgrOptions is merged one level deeper, so setting only svgrOptions.icon keeps the default exportType. When tools.svgr is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. An array of objects and functions is also accepted and applied in order. Parallel transform The SVGR transform is pure JavaScript and runs on the Node.js main thread by default. With many SVG files, enable parallel to move the transform into a pool of worker threads: Changing the default export svgrOptions.exportType controls what an SVG file exports by default: 'named' exports the file URL by default and the React component as the named export ReactComponent; 'default' exports the React component by default. Disabling SVGR If you are sure that no SVG asset in your project is used as a React component, disable SVGR to improve build performance: Relation to the legacy options tools.svgr replaces the two deprecated options below. They still work today and will be removed in the next major version: When both are set, tools.svgr wins: once tools.svgr is set explicitly, output.disableSvgr no longer applies, and tools.svgr.svgrOptions.exportType overrides the value derived from output.svgDefaultExport.
138
139
  - [swc](/configure/app/tools/swc.md): Type: Object | FunctionDefault: undefined
139
140
  - [tsChecker](/configure/app/tools/ts-checker.md): Type: Object | FunctionDefault: By default, the @rsbuild/plugin-type-check is enabled for type checking. You can use output.disableTsChecker config to disable it.
140
141
  - [aliasStrategy](/configure/app/source/alias-strategy.md): Type: 'prefer-tsconfig' | 'prefer-alias'Default: 'prefer-tsconfig' source.aliasStrategy is used to control the priority between the paths option in tsconfig.json and the alias option in the bundler.
@@ -225,11 +226,11 @@
225
226
  - [Introduction](/plugin/introduction.md): Modern.js provides a powerful plugin system that allows developers to extend the framework's functionality, customize the build process, and meet a variety of personalized development needs. Whether you want to add a custom command, optimize build output, or implement a unique deployment solution, Modern.js's plugin system provides robust support.
226
227
  - [Plugin System](/plugin/plugin-system.md): Modern.js adopts a highly extensible, plugin-based architecture, where its core functionalities and extended capabilities are implemented through plugins. The plugin system not only ensures the framework's flexibility but also provides developers with powerful customization options. This document focuses on how to write Modern.js plugins, helping you quickly get started with plugin development.
227
228
  - [CLI Plugin API](/plugin/cli-plugins/api.md): Modern.js's CLI plugins allow you to extend and customize the functionality of Modern.js projects during the build and development process.
228
- - [Life Cycle](/plugin/cli-plugins/life-cycle.md): `} </Mermaid>
229
+ - [Life Cycle](/plugin/cli-plugins/life-cycle.md): `}
229
230
  - [Plugin API](/plugin/runtime-plugins/api.md): Modern.js's Runtime Plugins allow you to extend and modify the behavior of your application during its React code execution. With Runtime Plugins, you can easily perform initialization tasks, implement React Higher-Order Component (HOC) wrapping, and more.
230
- - [Life Cycle](/plugin/runtime-plugins/life-cycle.md): `} </Mermaid>
231
+ - [Life Cycle](/plugin/runtime-plugins/life-cycle.md): `}
231
232
  - [Plugin API](/plugin/server-plugins/api.md): Modern.js's Server plugins allow you to extend and customize functionality during the server-side request processing phase, such as adding middleware, modifying request responses, etc.
232
- - [Life Cycle](/plugin/server-plugins/life-cycle.md): `} </Mermaid>
233
+ - [Life Cycle](/plugin/server-plugins/life-cycle.md): `}
233
234
  - [Overview](/plugin/official/cli-plugins.md): @modern-js/plugin-bff: Provides BFF services and unified invocation capabilities.@modern-js/plugin-ssg: Provides static site generation capabilities.
234
235
  - [BFF Plugin](/plugin/official/cli-plugins/plugin-bff.md): In a Modern.js application, developers can define API files under the api/lambda directory and export API functions using the BFF plugin. In the frontend code, these API functions can be directly invoked by importing the file, which initiates the API requests. For more details, refer to BFF - Basic Usage.
235
236
  - [SSG Plugin](/plugin/official/cli-plugins/plugin-ssg.md): SSG (Static Site Generation) is a technical solution that renders complete static web pages at build time based on data and templates. This means that in a production environment, pages are populated with content by default and can be cached by a CDN. For pages that do not require dynamic data, SSG can provide better performance and higher security. For more details, refer to Static Site Generation (SSG).
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # CLI Plugin API
2
4
 
3
5
  Modern.js's CLI plugins allow you to extend and customize the functionality of Modern.js projects during the build and development process.
@@ -1,2 +1,4 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Life Cycle
2
4
 
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Introduction
2
4
 
3
5
  Modern.js provides a powerful plugin system that allows developers to extend the framework's functionality, customize the build process, and meet a variety of personalized development needs. Whether you want to add a custom command, optimize build output, or implement a unique deployment solution, Modern.js's plugin system provides robust support.
@@ -126,16 +128,16 @@ You can read [Rsbuild Official Website - Plugins](https://v2.rsbuild.rs/plugins/
126
128
 
127
129
  The following are official Rsbuild plugins that are already built into Modern.js. They can be enabled without installation:
128
130
 
129
- | Plugin | Description | Modern.js Link |
130
- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
131
- | [React Plugin](https://v2.rsbuild.rs/plugins/list/plugin-react) | Provides support for React | - |
132
- | [SVGR Plugin](https://v2.rsbuild.rs/plugins/list/plugin-svgr) | Supports converting SVG images into React components | [output.disableSvgr](/configure/app/output/disable-svgr.md)<br />[output.svgDefaultExport](/configure/app/output/svg-default-export.md) |
133
- | [Assets Retry Plugin](https://github.com/rstackjs/rsbuild-plugin-assets-retry) | Automatically retries requests when static asset loading fails | [output.assetsRetry](/configure/app/output/assets-retry.md) |
134
- | [Type Check Plugin](https://github.com/rstackjs/rsbuild-plugin-type-check) | Runs TypeScript type checking in a separate process | [output.disableTsChecker](/configure/app/output/disable-ts-checker.md)<br />[tools.tsChecker](/configure/app/tools/ts-checker.md) |
135
- | [Source Build Plugin](https://github.com/rstackjs/rsbuild-plugin-source-build) | For monorepo scenarios, supports referencing source code from other subdirectories and completing builds and hot updates | [experiments.sourceBuild](/configure/app/experiments/source-build.md) |
136
- | [Check Syntax Plugin](https://github.com/rstackjs/rsbuild-plugin-check-syntax) | Analyzes the syntax compatibility of the build artifacts to determine if there are any advanced syntax features that cause compatibility issues | [security.checkSyntax](/configure/app/security/check-syntax.md) |
137
- | [CSS Minimizer Plugin](https://github.com/rstackjs/rsbuild-plugin-css-minimizer) | Used to customize the CSS compression tool, switch to [cssnano](https://cssnano.co/) or other tools for CSS compression | [tools.minifyCss](/configure/app/tools/minify-css.md) |
138
- | [Rem Plugin](https://github.com/rstackjs/rsbuild-plugin-rem) | Implements rem adaptive layout for mobile pages | [output.convertToRem](/configure/app/output/convert-to-rem.md) |
131
+ | Plugin | Description | Modern.js Link |
132
+ | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
133
+ | [React Plugin](https://v2.rsbuild.rs/plugins/list/plugin-react) | Provides support for React | - |
134
+ | [SVGR Plugin](https://v2.rsbuild.rs/plugins/list/plugin-svgr) | Supports converting SVG images into React components | [tools.svgr](/configure/app/tools/svgr.md) |
135
+ | [Assets Retry Plugin](https://github.com/rstackjs/rsbuild-plugin-assets-retry) | Automatically retries requests when static asset loading fails | [output.assetsRetry](/configure/app/output/assets-retry.md) |
136
+ | [Type Check Plugin](https://github.com/rstackjs/rsbuild-plugin-type-check) | Runs TypeScript type checking in a separate process | [output.disableTsChecker](/configure/app/output/disable-ts-checker.md)<br />[tools.tsChecker](/configure/app/tools/ts-checker.md) |
137
+ | [Source Build Plugin](https://github.com/rstackjs/rsbuild-plugin-source-build) | For monorepo scenarios, supports referencing source code from other subdirectories and completing builds and hot updates | [experiments.sourceBuild](/configure/app/experiments/source-build.md) |
138
+ | [Check Syntax Plugin](https://github.com/rstackjs/rsbuild-plugin-check-syntax) | Analyzes the syntax compatibility of the build artifacts to determine if there are any advanced syntax features that cause compatibility issues | [security.checkSyntax](/configure/app/security/check-syntax.md) |
139
+ | [CSS Minimizer Plugin](https://github.com/rstackjs/rsbuild-plugin-css-minimizer) | Used to customize the CSS compression tool, switch to [cssnano](https://cssnano.co/) or other tools for CSS compression | [tools.minifyCss](/configure/app/tools/minify-css.md) |
140
+ | [Rem Plugin](https://github.com/rstackjs/rsbuild-plugin-rem) | Implements rem adaptive layout for mobile pages | [output.convertToRem](/configure/app/output/convert-to-rem.md) |
139
141
 
140
142
  #### Plugins Not Built-in
141
143
 
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # BFF Plugin
2
4
 
3
5
  In a Modern.js application, developers can define API files under the `api/lambda` directory and export API functions using the BFF plugin. In the frontend code, these API functions can be directly invoked by importing the file, which initiates the API requests.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # SSG Plugin
2
4
 
3
5
  SSG (Static Site Generation) is a technical solution that renders complete static web pages at build time based on data and templates. This means that in a production environment, pages are populated with content by default and can be cached by a CDN. For pages that do not require dynamic data, SSG can provide better performance and higher security.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Styled Components Plugin
2
4
 
3
5
  In a Modern.js application, developers can use the Styled Components plugin to utilize the styled-components library within the app, enabling CSS-in-JS functionality.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Overview
2
4
 
3
5
  - [@modern-js/plugin-bff](/plugin/official/cli-plugins/plugin-bff.md): Provides BFF services and unified invocation capabilities.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Plugin System
2
4
 
3
5
  Modern.js adopts a highly extensible, plugin-based architecture, where its core functionalities and extended capabilities are implemented through plugins. The plugin system not only ensures the framework's flexibility but also provides developers with powerful customization options. This document focuses on how to write Modern.js plugins, helping you quickly get started with plugin development.
@@ -190,9 +192,7 @@ Example:
190
192
  // Define Hooks
191
193
  import { createSyncHook } from '@modern-js/plugin';
192
194
 
193
- type RouteObject = {
194
- /** TODO **/
195
- };
195
+ type RouteObject = {/** TODO **/};
196
196
  const modifyRoutes = createSyncHook<(routes: RouteObject[]) => RouteObject[]>();
197
197
 
198
198
  // Register Hooks in the plugin
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Plugin API
2
4
 
3
5
  Modern.js's Runtime Plugins allow you to extend and modify the behavior of your application during its React code execution. With Runtime Plugins, you can easily perform initialization tasks, implement React Higher-Order Component (HOC) wrapping, and more.
@@ -1,2 +1,4 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Life Cycle
2
4
 
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Plugin API
2
4
 
3
5
  Modern.js's Server plugins allow you to extend and customize functionality during the server-side request processing phase, such as adding middleware, modifying request responses, etc.
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Life Cycle
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Route Authorization
2
4
 
3
5
  Modern.js defaults to the convention-based routing based on React Router v7. For more details, please refer to [Routing](/guides/basic-features/routes/routes.md#routing).
@@ -1,3 +1,5 @@
1
+ > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
2
+
1
3
  # Modern.js Example Library
2
4
 
3
5
  Welcome to Modern.js Example Library! Here you'll find practical code examples to help you get started with Modern.js quickly.
package/lib/types.d.ts CHANGED
@@ -186,7 +186,6 @@ declare module '*?url' {
186
186
  export default src;
187
187
  }
188
188
 
189
-
190
189
  declare module '*.css' {
191
190
  const classes: { readonly [key: string]: string };
192
191
  export default classes;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.9.2",
18
+ "version": "3.10.0",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -113,11 +113,11 @@
113
113
  }
114
114
  },
115
115
  "dependencies": {
116
- "@babel/parser": "^7.29.7",
117
- "@babel/traverse": "^7.29.7",
118
- "@babel/types": "^7.29.7",
119
- "@rsbuild/core": "2.2.7",
120
- "@swc/core": "1.15.41",
116
+ "@babel/parser": "^7.29.9",
117
+ "@babel/traverse": "^7.29.10",
118
+ "@babel/types": "^7.29.8",
119
+ "@rsbuild/core": "2.2.13",
120
+ "@swc/core": "1.16.18",
121
121
  "@swc/helpers": "^0.5.17",
122
122
  "es-module-lexer": "^1.7.0",
123
123
  "flatted": "^3.4.4",
@@ -126,19 +126,18 @@
126
126
  "ndepe": "^0.1.13",
127
127
  "pkg-types": "^1.3.1",
128
128
  "std-env": "^3.10.0",
129
- "@modern-js/builder": "3.9.2",
130
- "@modern-js/i18n-utils": "3.9.2",
131
- "@modern-js/plugin": "3.9.2",
132
- "@modern-js/plugin-data-loader": "3.9.2",
133
- "@modern-js/prod-server": "3.9.2",
134
- "@modern-js/server": "3.9.2",
135
- "@modern-js/server-core": "3.9.2",
136
- "@modern-js/server-utils": "3.9.2",
137
- "@modern-js/types": "3.9.2",
138
- "@modern-js/utils": "3.9.2"
129
+ "@modern-js/builder": "3.10.0",
130
+ "@modern-js/i18n-utils": "3.10.0",
131
+ "@modern-js/plugin": "3.10.0",
132
+ "@modern-js/plugin-data-loader": "3.10.0",
133
+ "@modern-js/prod-server": "3.10.0",
134
+ "@modern-js/server": "3.10.0",
135
+ "@modern-js/server-core": "3.10.0",
136
+ "@modern-js/server-utils": "3.10.0",
137
+ "@modern-js/utils": "3.10.0",
138
+ "@modern-js/types": "3.10.0"
139
139
  },
140
140
  "devDependencies": {
141
- "@rslib/core": "1.0.0",
142
141
  "@types/babel__traverse": "7.28.0",
143
142
  "@types/node": "^20",
144
143
  "ts-node": "^10.9.2",
@@ -165,8 +164,8 @@
165
164
  "access": "public"
166
165
  },
167
166
  "scripts": {
168
- "dev": "rslib build --watch",
169
- "build": "rslib build && node ./bin/modern-bundle-docs.js",
167
+ "dev": "rs lib --watch",
168
+ "build": "rs lib && node ./bin/modern-bundle-docs.js",
170
169
  "test": "rstest"
171
170
  }
172
171
  }
@@ -1,8 +1,8 @@
1
1
  import path from 'path';
2
2
  import { rslibConfig } from '@modern-js/rslib';
3
- import { defineConfig } from '@rslib/core';
3
+ import { define } from 'rstack';
4
4
 
5
- export default defineConfig({
5
+ define.lib({
6
6
  ...rslibConfig,
7
7
  lib: rslibConfig.lib?.map(libConfig => {
8
8
  return {
@@ -37,11 +37,11 @@ export default defineConfig({
37
37
  ]),
38
38
  {
39
39
  from: 'plugins/deploy/platforms/templates/*.cjs',
40
- context: path.join(__dirname, 'src'),
40
+ context: path.join(import.meta.dirname, 'src'),
41
41
  },
42
42
  {
43
43
  from: 'plugins/deploy/platforms/templates/*.mjs',
44
- context: path.join(__dirname, 'src'),
44
+ context: path.join(import.meta.dirname, 'src'),
45
45
  },
46
46
  ],
47
47
  },
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.r = (exports1)=>{
5
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
- value: 'Module'
7
- });
8
- Object.defineProperty(exports1, '__esModule', {
9
- value: true
10
- });
11
- };
12
- })();
13
- var __webpack_exports__ = {};
14
- __webpack_require__.r(__webpack_exports__);
15
- for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
- Object.defineProperty(exports, '__esModule', {
17
- value: true
18
- });
File without changes
@@ -1 +0,0 @@
1
- import "node:module";
@@ -1,8 +0,0 @@
1
- import type { TestConfig } from '@modern-js/types';
2
- export interface TestingUserConfig {
3
- /**
4
- * Decide which transformer will be used to compile file
5
- * @default 'babel-jest'
6
- */
7
- transformer?: TestConfig['transformer'];
8
- }