Repository navigation
Replies: 1 comment
|
You can import the image as an asset instead of using the public directory. Then you can use a vite plugin to compress images. import login1 from '~/assets/login1.gif';
<img :src="login1" />https://wxt.dev/guide/assets.html#assets-directory This will only work for HTML pages inside an extension. If you try to use this approach for content scripts, the file will attempt to be loaded from the website you're on, not the extension, since in production it's loaded as an absolute path without a hostname, like |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am using wxt + Vue + typescript, In my option page components, import images like this,
since
login1.gifis stored in<rootDir>/public/images/login1.gif, wxt just copy it to the .output resultWhat I wish to have, before wxt serve or build the extension, it compress the images first, and I can import the compressed version, just like
of cause, those images willing to be compressed should be put in the specify directory other than
<rootDir>/public.Also be careful of the typescript declaration collected and defined by
.wxt/types/paths.d.ts, shall includes the compressed one ?All reactions