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
Directly related to this issue: #7770 which I have commented on also.
Looks like this has been included in Vite 4.2.0-beta.1. The changes to vite:resolve appear to work as it does resolve a subpath import correctly but it cannot be used with a real world codebase because import-analysis does not understand what to do with a subpath import when given it and so it resolves to null instead which returns:
PM [vite] Internal server error: Failed to resolve import "#src/routes/app_router" from "src/main.tsx". Does the file exist?
Plugin: vite:import-analysis
File: /path/to/codebase/apps/www/src/main.tsx:1:26
4 | import { $$registry as _$$registry } from "solid-refresh";
5 | const _REGISTRY = _$$registry();
6 | import { AppRouter } from '#src/routes/app_router';
| ^
Annotated with a bunch of console.log statements when trying to debug this I can see the following:
(1) asked to resolve: #src/routes/app_router
(2) problem is here: null
(3) asked to resolve: #src/routes/app_router resolved to: [ './src/routes/app_router.js' ]
(1) is from within vite:import-analysis right before it switches on if (!resolved).
console.log('asked to resolve:',url)constresolved=awaitthis.resolve(url,importerFile);if(!resolved){
(2) is from within that if statement.
(3) is from within vite:resolve.
import-analysis calls some resolve method (I'm working with the post-bundled source here so there are umpteen definitions for that function) which doesn't know what to do hence the failure.
I'll try actually find this in the normal codebase before it's been bundled.
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.
tsujp
changed the title
ESM subpath issues fail to be resolved by vite:import-analysis
ESM subpath imports fail to be resolved by vite:import-analysisMar 11, 2023
sun0day
added a commit
to sun0day/vite
that referenced
this issue
Mar 11, 2023
Describe the bug
Directly related to this issue: #7770 which I have commented on also.
Looks like this has been included in Vite
4.2.0-beta.1
. The changes tovite:resolve
appear to work as it does resolve a subpath import correctly but it cannot be used with a real world codebase becauseimport-analysis
does not understand what to do with a subpath import when given it and so it resolves tonull
instead which returns:Annotated with a bunch of
console.log
statements when trying to debug this I can see the following:(1) is from within
vite:import-analysis
right before it switches onif (!resolved)
.(2) is from within that
if
statement.(3) is from within
vite:resolve
.import-analysis
calls some resolve method (I'm working with the post-bundled source here so there are umpteen definitions for that function) which doesn't know what to do hence the failure.I'll try actually find this in the normal codebase before it's been bundled.
Minimum reproducible example here: https://stackblitz.com/edit/github-c6tkmr-1eubsp?file=src/index.tsx
Reproduction
https://stackblitz.com/edit/github-c6tkmr-1eubsp?file=src/index.tsx
Steps to reproduce
See above reproducible link.
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: