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

Import failure on file path with spaces #9917

Open
7 tasks done
clarkdo opened this issue Aug 30, 2022 · 3 comments
Open
7 tasks done

Import failure on file path with spaces #9917

clarkdo opened this issue Aug 30, 2022 · 3 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@clarkdo
Copy link
Contributor

clarkdo commented Aug 30, 2022

Describe the bug

Related issue: nitrojs/nitro#448 and vitest-dev/vitest#1937

When importing a module path with spaces, vite-node will throw Error: [vite-node] Failed to load, but it works fine in node env.

This works in Node.js:

const util = await import("file:///test/test%20dir/util.mjs")
console.log(util) // 123

But when we import this file in vitest, we'll see error:

import { describe } from 'vitest'

describe('test:suite', async () => {
  const util = await import("file:///test/test%20dir/util.mjs") // Error: [vite-node] Failed to load /test/test%20dir/util.mjs
  console.log(util)
})

Reproduction

https://github.com/clarkdo/vest-import-with-spaces-issue

System Info

System:
    OS: macOS 12.5.1
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0
    npm: 8.15.0
  Browsers:
    Chrome: 104.0.5112.101
  npmPackages:
    vitest: ^0.22.1 => 0.22.1

Used Package Manager

pnpm

Logs

No response

Validations

@pi0
Copy link
Contributor

pi0 commented Aug 31, 2022

@antfu Can you please check this if had time? 🙏🏼

@sheremet-va
Copy link
Member

I think this issue might be lost without a priority badge @bluwy 😄

@surjithctly
Copy link

Any workaround for this since it conflicts with Astro v5. Their issue withastro/astro#12556 is closed as upstream bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

6 participants