Appearance
替换插件
¥Replace Plugin
replacePlugin 是一个内置的 Rolldown 插件,它基于字符串操作来替换代码。这相当于 @rollup/plugin-replace。
¥The replacePlugin is a built-in Rolldown plugin that replaces the code based on string manipulation. This is an equivalent of @rollup/plugin-replace.
用法
¥Usage
从 Rolldown 的实验性导出中导入并使用该插件:
¥Import and use the plugin from Rolldown's experimental exports:
js
import { defineConfig } from 'rolldown';
import { replacePlugin } from 'rolldown/experimental';
export default defineConfig({
input: 'src/index.js',
output: {
dir: 'dist',
format: 'esm',
},
plugins: [
replacePlugin(
{
'process.env.NODE_ENV': JSON.stringify('production'),
__buildVersion: 15,
},
{
preventAssignment: false,
},
),
],
});选项
¥Options
待记录
¥To be documented
限制
¥Limitations
待记录
¥To be documented