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

Also warn when absolute file paths include ? during build (relates to #14165) #15726

Closed
7 tasks done
poppa opened this issue Jan 27, 2024 · 1 comment · Fixed by #15761
Closed
7 tasks done

Also warn when absolute file paths include ? during build (relates to #14165) #15726

poppa opened this issue Jan 27, 2024 · 1 comment · Fixed by #15761
Labels

Comments

@poppa
Copy link
Contributor

poppa commented Jan 27, 2024

Describe the bug

As per issue #14165 you should also warn when paths include ?, since those paths will fail miserably as well.

I guess the reason is that ESM uses URLs for imports, and what follows after ? and # are not part of the path in an URL.

Paths including any other URL-reserved character seems to be resolved correctly (but don't quote me on that).

Reproduction

https://stackblitz.com/edit/vitejs-vite-vxwonj?file=main.js

Steps to reproduce

No response

System Info

I guess all systems

Used Package Manager

npm

Logs

Build error output
[plugin:vite:import-analysis] Failed to resolve import "./some?dir/file.js" from "main.js". Does the file exist?

/home/projects/vitejs-vite-vxwonj/main.js:5:23

3  |  import viteLogo from '/vite.svg';
4  |  import { setupCounter } from './counter.js';
5  |  import { Test } from './some?dir/file.js';
   |                        ^
6  |  
7  |  console.log('Test:', Test);

    at formatError (/home/projects/vitejs-vite-vxwonj/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:63814:46)
    at error (/home/projects/vitejs-vite-vxwonj/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:63808:19)
    at normalizeUrl (/home/projects/vitejs-vite-vxwonj/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:62083:33

Validations

Copy link

stackblitz bot commented Jan 27, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@poppa poppa changed the title Also warn when absolute file paths include ? during build (relates to #14165) Also warn when absolute file paths include ? during build (relates to #14165) Jan 27, 2024
@bluwy bluwy added enhancement New feature or request contribution welcome and removed pending triage labels Jan 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants