Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot split a chunk that has already been edited #3

Open
eight04 opened this issue Sep 6, 2017 · 0 comments
Open

Cannot split a chunk that has already been edited #3

eight04 opened this issue Sep 6, 2017 · 0 comments

Comments

@eight04
Copy link
Contributor

eight04 commented Sep 6, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant