Skip to content
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

Wrong filename generated when building in Windows #7191

Closed
7 tasks done
DaPotatoMan opened this issue Mar 6, 2022 · 1 comment
Closed
7 tasks done

Wrong filename generated when building in Windows #7191

DaPotatoMan opened this issue Mar 6, 2022 · 1 comment

Comments

@DaPotatoMan
Copy link

DaPotatoMan commented Mar 6, 2022

Describe the bug

Possible duplicate of #5627

This line in the code causes vite to generate a relative path instead of a filename in Windows 10. This can be fixed by changing the code to:

 this.emitFile({
  type: 'asset',
  fileName: path.basename(shortEmitName),
  source: result
})

Reproduction

https://stackblitz.com/edit/vitejs-vite-e2vahj?

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 AMD Ryzen 3 2200G with Radeon Vega Graphics
    Memory: 1.09 GB / 5.94 GB
  Binaries:
    Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 7.23.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.30)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vitejs/plugin-vue: ^2.2.4 => 2.2.4
    vite: ^2.8.6 => 2.8.6

Used Package Manager

pnpm

Logs

> demo@0.0.0 build X:\Projects\demo
> vite build

vite v2.8.6 building for production...
✓ 16 modules transformed.
rendering chunks (4)...[vite:build-html] The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../../../X:\Projects\demo\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 "../../../X:\Projects\demo\index.html".
    at error (X:\Projects\demo\node_modules\.pnpm\registry.npmjs.org+rollup@2.68.0\node_modules\rollup\dist\shared\rollup.js:159:30)
    at FileEmitter.emitFile (X:\Projects\demo\node_modules\.pnpm\registry.npmjs.org+rollup@2.68.0\node_modules\rollup\dist\shared\rollup.js:15476:24)
    at Object.generateBundle (X:\Projects\demo\node_modules\.pnpm\registry.npmjs.org+vite@2.8.6\node_modules\vite\dist\node\chunks\dep-9c153816.js:21691:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
 ELIFECYCLE  Command failed with exit code 1.

Validations

@DaPotatoMan
Copy link
Author

Fixed by #7383

@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants