简体   繁体   中英

How can I replace multiple strings with rollup-replace

The first replace works, the second not. I just can't get it from the docs here what to do: https://github.com/rollup/plugins/tree/master/packages/replace

export default {
  input: './src/js/index.js',
  output: {
    file: 'dist/build.js',
    format: 'iife',
  },
  plugins: [
    replace(
      { 'originalprefix-': 'myprefix-', delimiters: ['', ''] },
      { 'ABCprefix': 'DEFprefix', delimiters: ['', ''] }
    ),

I also tried this, but it seems multiple runs create double replaces:

    replace(
      { 'origprefix-': 'myprefix-', delimiters: ['', ''] },
    ),
    replace(
      { 'ABCprefix': 'DEFprefix', delimiters: ['', ''] }
    ),

Same here:

    replace(
      { 
       'origprefix-': 'myprefix-', delimiters: ['', ''],
       'ABCprefix': 'DEFprefix', delimiters: ['', ''] 
      }
    ),
replace({ 
    'origprefix-': 'myprefix-',
    'ABCprefix': 'DEFprefix',
    delimiters: ['', ''] 
}),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM