Closed Elliot67 closed 7 months ago
I have also encountered this problem, how to solve it?
@chen99-long , I worked around the issue by adding the <base href="http://localhost:3303/" />
tag in the <head>
of my options & popup html pages. Vite seems to remove the tag at build time but it can create other issues depending on your extension.
I think the proper fix should be done inside the Vite configuration directly.
Thank you very much
Facing the same issue at the moment even on a completely new project. @antfu is this a known issue?
same issues
Describe the bug
In development mode, assets inside the
src/assets
folder cannot be imported from components.Explanation
Importing an image with
<img src="/assets/icon.svg" />
will resolve to<img src="/assets/icon.svg" />
instead of<img src="http://localhost:3303/assets/icon.svg" />
. When the app is builded, the image will resolve to/dist/assets/icon-03081ed2.svg
which works.The provided example inside
src/options/Options.vue
currently only works because the same file exists in theextension/assets
folder.Note :
url('/assets/roboto.woff2')
Possible solutions
<base>
tag tohttp://localhost:3303/
and remove it at build timeReproduction
Rename
src/assets/icon.svg
to something else and fix the import insidesrc/options/Options.vue
System Info
Used Package Manager
yarn
Validations