V2+ only. For the vue templates, when I tried to reference an image like so, the build failed:
<img src="/icon-with-shadow.svg">
Since internally, the public directory is disabled for the HTML and script builds, if a plugin relies on it to resolve root level modules, like the vue plugin does for loading modules at a given src, the build can fail.
The solution in this case is easy, use a string literally instead, and it won't be treated as a module:
<img :src="'/icon-with-shadow.svg'">
But you shouldn't have to do that. Child builds should be able to resolve modules in the public directory.
Potentially, we could enable the public directory for child builds. It would result in the files being copied multiple times, but would be a simple solution.
Steps to Reproduce
pnpm create test -t vue-ts
cd test
# Update pages/Popup.vue with <img src="/icon-with-shadow.svg">
pnpm dev
Overview
V2+ only. For the vue templates, when I tried to reference an image like so, the build failed:
Since internally, the public directory is disabled for the HTML and script builds, if a plugin relies on it to resolve root level modules, like the vue plugin does for loading modules at a given src, the build can fail.
The solution in this case is easy, use a string literally instead, and it won't be treated as a module:
But you shouldn't have to do that. Child builds should be able to resolve modules in the
public
directory.Potentially, we could enable the public directory for child builds. It would result in the files being copied multiple times, but would be a simple solution.
Steps to Reproduce
Changes