-
-
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(vite): emitAssetsWithModule in library mode #9734
base: main
Are you sure you want to change the base?
Conversation
@yoyo930021 Wouldn't it make more sense for lib mode to respect the |
I don't think it's a good idea. When enable this option, it also respect |
I need this PR~ |
This PR is a must have for a library, please merge? |
hows the progress on this? |
Unless I am missing a workaround, I can't use Vite for a new Vue3 component library because of this. I would adventure to go back to native Rollup, however rollup-plugin-vue has been archived for almost a year with this message:
Would be nice if this is finally reviewed and merged. |
For those looking for a quick and dirty solution here is what you could do if you use
Although, I've found one issue with this: my assets are in |
The PR is based on old vite main branch. It may not apply to the latest version. |
@yoyo930021 I was using vite 3.1.8, so that could be the case, yeah. |
We need this, without this, we may choose to introduce rollup to replace vite lib mode |
Is this going to be merged any time soon? |
In esbuild, the name is |
cf8d774
e313edd
to
cf8d774
Compare
I rebase this PR from main branch. |
cf8d774
to
349e296
Compare
We need this feature too, Vite is a great tool but this feature was a hole in the racket 🙏 Great work ! |
Any updates? We would love this feature! |
Description
Fixed #4454
Fixed #3295
We replace asset to base64 for lib mode by default, It can handle most of the contexts.
But it will add a lot of size in JS/CSS and disallow for CSP.
In this PR, we add a
emitAssetsWithModule
option.When enable this option, vite will try to emit assets and generate original import code in JS or CSS.
For example:
The
emitAssetsWithModule
will try to generate module with assets. When enable this option, please use bundler in user project.Additional context
No.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).