Breaking changes in Rsbuild v1.0.0 #2508
Replies: 14 comments 13 replies
-
Upgrade Rspack v1.0.0Rsbuild v1.0.0 will upgrade the dependent Rspack v1.0.0 contains some breaking changes, see web-infra-dev/rspack#6626 for more details. |
Beta Was this translation helpful? Give feedback.
-
Rename
|
Beta Was this translation helpful? Give feedback.
-
Replace
|
Beta Was this translation helpful? Give feedback.
-
output.overrideBrowserslist
export default {
output: {
overrideBrowserslist: {
web: ['iOS >= 9', 'Android >= 4.4'],
node: ['node >= 20'],
},
},
};
export default defineConfig({
environments: {
web: {
output: {
overrideBrowserslist: ['iOS >= 9', 'Android >= 4.4'],
},
},
node: {
output: {
overrideBrowserslist: ['node >= 20'],
},
},
},
}); |
Beta Was this translation helpful? Give feedback.
-
output.emitAssets
export default {
output: {
targets: ['web', 'node'],
emitAssets: ({ target }) => target !== 'node',
},
};
export default {
environments: {
web: {
output: {
target: 'web',
},
},
node: {
output: {
target: 'node',
emitAssets: false,
},
},
},
}; |
Beta Was this translation helpful? Give feedback.
-
source.aliasRemove
export default {
source: {
alias: (alias, { target }) => {
if (target === 'node') {
alias['@common'] = './src/node/common';
} else if (target === 'web') {
alias['@common'] = './src/web/common';
}
},
},
output: {
targets: ['web', 'node'],
}
};
export default {
environments: {
web: {
source: {
alias: {
'@common': './src/web/common',
},
},
output: {
target: 'web',
},
},
node: {
source: {
alias: {
'@common': './src/node/common',
},
},
output: {
target: 'node',
},
},
},
}; |
Beta Was this translation helpful? Give feedback.
-
Decorators VersionRsbuild now uses If you are using the legacy decorators, you can add the following config: // rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
export default defineConfig({
source: {
decorators: {
version: 'legacy',
},
},
}); SWC currently does not support |
Beta Was this translation helpful? Give feedback.
-
distPath.serverRemoved export default {
environments: {
web: {
output: {
target: 'web',
},
},
node: {
output: {
target: 'node',
distPath: {
root: 'dist/server',
},
},
},
},
}; |
Beta Was this translation helpful? Give feedback.
-
source.entryRemove function usage of
export default {
source: {
entry({ target }) {
if (target === 'web') {
return {
index: './src/index.client.js',
};
}
if (target === 'node') {
return {
index: './src/index.server.js',
};
}
},
},
output: {
targets: ['web', 'node'],
},
};
export default {
environments: {
web: {
source: {
entry: {
index: './src/index.client.js',
},
},
output: {
target: 'web',
},
},
node: {
source: {
entry: {
index: './src/index.server.js',
},
},
output: {
target: 'node',
},
},
},
}; |
Beta Was this translation helpful? Give feedback.
-
api.getHTMLPathsRemove
const pluginFoo = () => ({
setup(api) {
api.modifyRspackConfig(() => {
const htmlPaths = api.getHTMLPaths();
console.log(htmlPaths); // { index: 'index.html' };
});
},
});
const pluginFoo = () => ({
setup(api) {
api.modifyRspackConfig((config, { environment }) => {
const { htmlPaths } = environment;
console.log(htmlPaths); // { index: 'index.html' };
});
},
}); |
Beta Was this translation helpful? Give feedback.
-
api.contextRemove const pluginFoo = () => ({
setup(api) {
api.modifyBundlerChain((chain, { environment }) => {
- const { entry, targets, tsconfigPath, distPath } = api.context;
+ const { entry, tsconfigPath, distPath, config: { output: { target } } } = environment;
});
api.onDevCompileDone(async ({ isFirstCompile, stats, environments }) => {
- const entries = Object.keys(api.context.entry);
+ const entries = Object.values(environments).map(e => e.entry);
})
},
}); |
Beta Was this translation helpful? Give feedback.
-
output.polyfillRsbuild 1.0.0-alpha.4 set If your application need polyfill, please set // rsbuild.config.ts
export default {
output: {
polyfill: 'usage'
}
}; See the vote on Twitter: https://x.com/rspack_dev/status/1808439138439274780 |
Beta Was this translation helpful? Give feedback.
-
Remove
|
Beta Was this translation helpful? Give feedback.
-
output.charsetThe default value of output.charset has been changed from ascii to utf8. If you need to use ascii, you can add the following config: export default {
output: {
charset: 'ascii',
},
}; |
Beta Was this translation helpful? Give feedback.
-
Rsbuild v1.0.0 is scheduled to be released in July 2024.
This thread is used to collect planned breaking changes for Rsbuild v1.0.0.
Beta Was this translation helpful? Give feedback.
All reactions