You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{rollup}from'rollup'importreplacefrom'rollup-plugin-re'importcommonjsfrom'rollup-plugin-commonjs'rollup({entry: 'main.js',plugins: [replace({// ... do replace before commonjspatterns: [{// regexp match with resolved pathmatch: /formidable(\/|\\)lib/,// string or regexptest: 'if (global.GENTLY) require = GENTLY.hijack(require);',// string or function to replaced withreplace: '',}]}),commonjs(),replace({// ... do replace after commonjs})]}).then(...)
{// a minimatch pattern, or array of patterns, of files that// should be processed by this plugin (if omitted, all files// are included by default)...include: 'config.js',// ...and those that shouldn't, if `include` is otherwise// too permissiveexclude: 'node_modules/**',defines: {IS_SKIP: false,IS_REMOVE: true,},replaces: {$version: "1.0.1"},patterns: [{include: [],// same as aboveexclude: [],// same as above// regexp match with resolved pathmatch: /formidable(\/|\\)lib/,// string or regexptest: 'if (global.GENTLY) require = GENTLY.hijack(require);',// string or functionreplace: '',},// replace whole file content{text: 'exports = "content"',// replace content with given text},{file: './replace.js',// replace with given relative file},{transform(code,id){// replace by functionreturn`'use strict';\n${code}`}}]}