-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for the preview mode of vite #14125
Comments
Hmm let me see if I get this right. Could you not see the production files by setting |
Vite does 2 main things:
So those are 2 quite different things. The dev mode is invoked via As explained above the built version is quite different from the dev version as they are built with a different set of tools. This is where the As explained in my first comment it should probably be implemented as an additional Does this make sense? A semi-related question is why the |
Yes, makes sense! :) I would say we should add a flag in the generator to let the user choose if they want the preview target to be generated or not. Do you want to work on this? |
I can probably take a look at that. I am not sure if there should be a flag for the |
I would appreciate the addition of this feature as well. |
I start feeling the pressure :) |
Update: At this point I have a POC @mandarini can I submit a PR with the executor first and then a PR updating the generators? (The idea is to make each PR small enough so that they are easier to review). |
@vicb sure, thanks! Indeed, you can make the executor PR, and push the generators in a later PR. :D :D |
@vicb let me know if you think we can close this feature request now! :) |
Maybe we can close it with my next PR that will be adding watch mode to the preview. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Description
Vite supports a local web server for dev (invoked via
vite
) but it also supports serving the built files (invoked viavite preview
)The current
serve
target of thevite
plugin uses the local dev server (vite
).It would be nice to add a
preview
target using the built files.Motivation
The files served with
vite
do not match what will be served in production.It would be nice to be able to test the actual files used in production (that is the output of the
build
target).Suggested Implementation
I have tried to run
vite preview
from my app folder after having built the project.I only had to to update
build.outDir
invite.config.ts
to make this work - that is set it to my app path. The reason for that is that this config is dynamically generated by nx/vite.The implementation of the
preview
target should use that options-utils.ts to set the config.I think it would also make sense to set the preview.proxy reusing this code
The text was updated successfully, but these errors were encountered: