You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the HTML entry point specified for vite build is provided by such a virtual file plugin, its content is correctly loaded, but bundling fails because shortEmitName looks like "../../../../@virtual:vite-plugin-virtual/Users/fwouts/dev/vite-virtual-html/index.html":
✓ 6 modules transformed.
rendering chunks (1)...[vite:build-html] The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../../../../@virtual:vite-plugin-virtual/Users/fwouts/dev/vite-virtual-html/index.html".
error during build:
Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../../../../@virtual:vite-plugin-virtual/Users/fwouts/dev/vite-virtual-html/index.html".
at error (file:///Users/fwouts/dev/vite-virtual-html/node_modules/.pnpm/rollup@2.77.3/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
at FileEmitter.emitFile (file:///Users/fwouts/dev/vite-virtual-html/node_modules/.pnpm/rollup@2.77.3/node_modules/rollup/dist/es/shared/rollup.js:15472:24)
at Object.generateBundle (file:///Users/fwouts/dev/vite-virtual-html/node_modules/.pnpm/vite@3.0.7/node_modules/vite/dist/node/chunks/dep-0f13c890.js:41599:22)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Overriding fileName with just the hardcoded value "index.html"here fixes it, although that's obviously not the right approach :)
Note 1: This appears related to #2321 but I don't think it's quite the same issue.
Note 2: In case you're wondering, one example where this would be useful is in Preview.js to allow users to generate a static, precompiled version of a particular component so they can share it around. For now, I can work around it by patching Vite on my end.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
When a file is generated by a virtual file plugin such as https://github.com/patak-dev/vite-plugin-virtual, the corresponding module ID may look like
/@virtual:vite-plugin-virtual/some/path/to/file
.When the HTML entry point specified for
vite build
is provided by such a virtual file plugin, its content is correctly loaded, but bundling fails becauseshortEmitName
looks like"../../../../@virtual:vite-plugin-virtual/Users/fwouts/dev/vite-virtual-html/index.html"
:Overriding
fileName
with just the hardcoded value"index.html"
here fixes it, although that's obviously not the right approach :)Note 1: This appears related to #2321 but I don't think it's quite the same issue.
Note 2: In case you're wondering, one example where this would be useful is in Preview.js to allow users to generate a static, precompiled version of a particular component so they can share it around. For now, I can work around it by patching Vite on my end.
Note 3: I'd be happy to make a PR for this.
Reproduction
https://github.com/fwouts/vite-virtual-html
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: