-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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: allow assets to be external instead of inline in lib mode. #6267
base: main
Are you sure you want to change the base?
Conversation
import _imports_0$1 from "./assets/some-image.68d77419.png";
It is OK if you consume the generated code via some bundlers. However, not all the bundlers handle this (import assets in javascript) in a same way. I think it's better not to assume all the users will use a bundler to consume the generated code. |
@hronro |
Unfortunately,
Using an absolute path does not work either. Absolute path generation depends on the value of Public Base Path (or output.publicPath in webpack), which can be different when different people using the library we build. It is not possible for us to determine the value of public base path at the time of building the library. |
@hronro |
really looking forward to it |
How do you use vite to build a component library? can you give me an example? |
Could this be merged? We really need this feature... |
Description
this PR solved #4454
As a newbie to vite, I have no idea whether this solution or the option design is is good enough, but it works in my case. I can tweak this if any feedback. If this looks too stupid, sry to bother, pls close it at will.
Additional context
This feature generate code like this in library mode:
css (if any):
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).