-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Allow preview mode for libraries #7009
Comments
@Niputi What's the status on this? |
Upvoting this. It would be great if this was possible so that we can more easily run our e2e tests on the production bundle. |
This is definitly needed |
A workaround Ive used is a second config file, i.e. vite.preview.js that's based on the default but doesnt have the library config. Then change your packages.json preview script to be |
+1, I need to run transformIndexHtml during preview only |
This produces a build of the rollupOptions: {
input: {
'index.html': 'index.html',
},
}, allowing me to |
@morganney your solutions works, kinda, but it transforms the index.html script tag so that the umd variant is being loaded, which results in browser errors. I can confirm it works if I only build the
Anyone else run into anything like this? |
Clear and concise description of the problem
I am building a web SDK.
I used the lib mode to configure my outputs.
I am developing the library in
esm
and my library is gonna be served incjs
. In order to make sure it's working (tests and manually) I need to copy/create index.html file and reference the output script (vite does it on regular mode OOO).Suggested solution
Therefore I want to allow 'lib preview' let me explain:
yarn vite preview
Alternative
Allow configuring 'preview' options to serve libraries
Additional context
I am also willing to contribute and open PR, if the authors will see this feature as meaningful to the platform
Validations
The text was updated successfully, but these errors were encountered: