Configuration Changes
This document mainly introduces incompatible configuration changes and recommended migration methods when upgrading from Modern.js 2.0 to 3.0.
dev
dev.port
Change: This configuration has been removed and replaced with server.port.
Migration Example:
html
html.appIcon
Change: String format is no longer supported, object format must be used.
V2 Type:
V3 Type:
Migration Example:
html.xxxByEntries
Change: Configurations such as metaByEntries, templateParametersByEntries, injectByEntries, tagsByEnties, faviconByEntries, templateByEnties, titleByEntries have been deprecated and need to be replaced with function syntax.
Migration Steps:
- Remove related configurations
- Use the function syntax of
html.xxxinstead
Migration Example:
html.disableHtmlFolder
Change: This configuration has been deprecated, use html.outputStructure instead.
Migration Example:
tools
tools.esbuild
Change: This configuration has been deprecated, you need to manually switch to esbuild minification.
tools.terser
Change: This configuration has been deprecated, you need to manually switch to Terser minification.
tools.devServer
Change 1: after, before, devMiddleware configurations have been deprecated, use dev.setupDevMiddlewares configuration instead.
Migration Example:
Change 2: client, https, liveReload configurations have been deprecated, use corresponding dev.client, dev.https, dev.liveReload configurations instead.
Migration Example:
Change 3: hot configuration has been deprecated, use dev.hmr configuration instead.
Migration Example:
Change 4: compress, headers, historyApiFallback, watch configurations have been deprecated, use dev.server.compress, dev.server.headers, dev.server.historyApiFallback, dev.server.watch configurations instead.
Migration Example:
tools.pug
Change: This configuration has been deprecated, use Rsbuild's Pug plugin to enable support.
Migration Example:
tools.rsdoctor
Change: This configuration has been deprecated, please refer to the Rsdoctor documentation and use Rspack's Rsdoctor plugin to enable support.
Migration Example:
tools.babel
Change: This configuration has been deprecated, the framework no longer includes Babel by default. Please use Rsbuild's Babel plugin to enable support.
Migration Example:
tools.tailwindcss
Change: This configuration has been deprecated, please refer to Tailwind Plugin Changes and use Rsbuild's approach to integrate Tailwind CSS.
tools.tsLoader
Change: Since Rspack does not support tsLoader, this configuration has been deprecated. The Rspack experiments.typeReexportsPresence configuration can be used to improve recognition of TypeScript type exports, which can assist with ts-loader migration.
tools.webpackChain
Change: This configuration has been deprecated, please migrate to tools.bundlerChain.
tools.webpack
Change: This configuration has been deprecated, please migrate webpack configuration to tools.rspack.
source
source.resolveMainFields
Change: This configuration has been deprecated, use resolve.mainFields instead.
Migration Example:
source.resolveExtensionPrefix
Change: This configuration has been deprecated, use resolve.extensions instead.
Migration Example:
source.moduleScopes
Change: This configuration has been deprecated, remove it directly.
source.enableCustomEntry
Change: This configuration has been deprecated, remove it directly.
source.disableEntryDirs
Change: This configuration has been deprecated, remove it directly.
source.alias
Change: This configuration no longer applies to code in custom Server and BFF. Aliases configured for server-side code need to be migrated to tsconfig.json.
Migration Example:
server.routes
Change: The default route has changed from main to index. If index exists in the server.routes configuration, migrate as follows.
Migration Example:
output
output.overrideBrowserslist
Change: Needs to be handled based on the project's existing configuration.
Migration Steps:
- Check if there is a
.browserslistrcfile in the project - Check if
output.overrideBrowserslistis configured inmodern.config.[ts|js] - Check if browserslist is configured in package.json
If none of the above exist, create a .browserslistrc file with the following content for browsers supporting ES6:
output.enableAssetFallback
Change: This configuration has been deprecated, comment it out and add a note.
output.cssModuleLocalIdentName
Change: This configuration has been deprecated, use output.cssModules.localIdentName instead.
Migration Example:
output.disableCssExtract
Change: This configuration has been deprecated, use output.injectStyles instead.
Migration Example:
output.disableFilenameHash
Change: This configuration has been deprecated, use output.filenameHash instead.
Migration Example:
output.disableMinimize
Change: This configuration has been deprecated, use output.minify instead.
Migration Example:
output.disableSourceMap
Change: This configuration has been deprecated, use output.sourceMap instead.
Migration Example:
output.enableInlineScripts
Change: This configuration has been deprecated, use output.inlineScripts instead.
Migration Example:
output.enableInlineStyles
Change: This configuration has been deprecated, use output.inlineStyles instead.
Migration Example:
output.enableLatestDecorators
Change: This configuration has been deprecated, use source.decorators instead.
Migration Example:
output.disableNodePolyfill
Change: This configuration has been deprecated, use pluginNodePolyfill plugin instead.
Migration Example:
plugins
app-tools plugin
Change: This plugin does not require any parameters.
Migration Example:
security
security.sri
Change: security.sri.hashLoading is no longer needed and can be removed directly.
runtime
runtime.router
Change: No longer needed, can be removed directly. This configuration has been moved to the router configuration in modern.runtime.ts.
Migration Example:
runtime.state
Change: This configuration has been deprecated, it is recommended to use a third-party state management library.
runtime.masterApp
Change: This configuration has been deprecated, move this configuration to the masterApp configuration in modern.runtime.ts.
Migration Example:
performance
performance.bundleAnalyze
Change: This configuration has been deprecated, it is recommended to use Rsdoctor to analyze bundle size.
performance.transformLodash
Change: No longer needed, can be removed directly.
Migration Example:
experiments
experiments.lazyCompilation
Change: This configuration has been deprecated, changed to dev.lazyCompilation.
Migration Example: