rollup-plugin-re icon indicating copy to clipboard operation
rollup-plugin-re copied to clipboard

Cannot split a chunk that has already been edited

Open eight04 opened this issue 7 years ago • 0 comments

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?

eight04 avatar Sep 06 '17 06:09 eight04