rollup-plugin-re
rollup-plugin-re copied to clipboard
Cannot split a chunk that has already been edited
The error is threw when two patterns overlap each others. input:
export default "hello 123 hello";
config:
import re from 'rollup-plugin-re';
export default {
input: 'test.js',
format: 'cjs',
plugins: [re({
patterns: [
{
test: /\d+ hello/g,
replace: 'something_else'
},
{
test: /hello \d+/g,
replace: 'world'
},
]
})]
};
I think it is a restriction of magic-string, and the pattern always matches against the input source instead of the code produced by previous replace pattern. Maybe it should be documented in the README, or, maybe the error should be silently ignored?