1.0.0 • Published 2 years ago

rollup-plugin-string-replace v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

rollup-plugin-string-replace

rollup字符传替换插件

使用rollup构建工程时,借助该插件可以替换代码片段;和@rollup/plugin-replace插件类似,优势在于可以按replacePairs指定顺序执行替换操作。

安装

npm install --save-dev rollup-plugin-string-replace

使用

--rollup-config.js

import replaceString from 'rollup-plugin-string-replace'

const config = [{
    input: ["src/index.js"],
    plugins: [
        replaceString({
            exclude: '**/node_modules/**',
            include: ["**/src/test.js"],
            replacePairs: [{
                source: "console.log",
                target: "console.warn"
            }],
            sourcemap: true
        })
    ],
    output: {
        file: "dist/dist.min.js",
        format: "umd",
        name: "test",
        sourcemap: true
    }
}];
export default config;
1.0.0

2 years ago