-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat: add option to exclude global define and env replacement #5577
Conversation
3a81141
to
352714c
Compare
@patak-dev Would it be possible to have this merged? Or maybe I might need a bit help on this issue. It's related to vuejs/vitepress#419 and it's breaking Vite 3 docs page as well (Env Variables and Modes page) 😅 |
@kiaking we need to discuss this with the team, but I don't think it is the best option. A user may want to use |
Ah, I see good to see the workaround. OK, in that case we can skip this issue targeting VitePress alpha and just workaround with that technique for now. We can relax a bit then 👍 |
I think we should find a more robust solution than a new config option to conditionally replace in some files. Maybe #11151 would help with this. IIRC there's also a builtin workaround for this in VitePress. Closing for now, but thanks for kicking off this option! |
Description
Intent to fix vuejs/vitepress#419, but not completely resolved.
vite will automatically escape and replace the string form"process.env.NODE_ENV:" content!!! #3077
Library Mode replaces "process.env.NODE_ENV" #3229
Handling server-side/sensitive/runtime variables #3176
Ideally, the replacement of define and env can be turned off by specifying options, as in my test example.
I put forward this PR to stimulate discussion about whether the problems caused by string replacement should be fixed.
This is just one of my attempts, there should be other better ways to welcome you to point it out.
Thank you for your positive opinions.
Additional context
When I wrote the test example, I also found the error of define and pre-building, see also: #5570
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).