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

Change contentOnly default to true #211

Closed
wants to merge 1 commit into from

Conversation

benmccann
Copy link
Contributor

This would fix vitejs/vite#7365.

To quote @dummdidumm on that issue:

The overwrite call removes all prepends/appends that were done on the start/end position if you don't pass in the { contentOnly: true } option as forth argument. I never came across a case where I would want the default behavior, so I'm always setting that option.

@dummdidumm
Copy link
Contributor

This would be a breaking change, and considering the huge download numbers of magic-string, this should be clearly communicated if accepted.

@antfu
Copy link
Collaborator

antfu commented Mar 21, 2022

Yeah, I feel the same. Since it won't actually block any usage, I would like to keep this thread open for a while longer to collect enough feedback from the community and only make this change if this is something most of us feel it's right to do.

@benmccann
Copy link
Contributor Author

Yeah, the other alternative I had debated was making it required. That would fix the issue of people unknowingly using the default which mostly causes issues without it being a breaking change

@patak-dev
Copy link

Maybe there could be another method (supplant, or a better word?) with the default we want, and overwrite could be deprecated? Or a global config option to define the default of overwrite so we can continue to use the same name?

ElMassimo added a commit to ElMassimo/iles that referenced this pull request Mar 22, 2022
@benmccann
Copy link
Contributor Author

Maybe there could be another method (supplant, or a better word?) with the default we want, and overwrite could be deprecated?

Yes, that's a much better solution. I've implemented that in #212

@benmccann benmccann closed this Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSR transform loses Object.defineProperty in certain cases
4 participants