Vite Automatically Appends Extensions to Imports – How Does It Work? #18166
Answered
by
hi-ogawa
centraldogma99
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
hi-ogawa
Sep 23, 2024
Replies: 1 comment
-
Technically it's not only "Automatically Appends Extensions", but that's what normally called "resolution", which includes looking up What you seeing in the diff is showing this plugin's transform, so you can follow this: vite/packages/vite/src/node/plugins/importAnalysis.ts Lines 255 to 257 in ba56cf4 The basic steps can be probably summarized in these three steps, 1: parse imports, 2: resolve imports, 3: replace imports |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
centraldogma99
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Technically it's not only "Automatically Appends Extensions", but that's what normally called "resolution", which includes looking up
node_modules
, handling#
alias, etc..What you seeing in the diff is showing this plugin's transform, so you can follow this:
vite/packages/vite/src/node/plugins/importAnalysis.ts
Lines 255 to 257 in ba56cf4
The basic steps can be probably summarized in these three steps, 1: parse imports, 2: resolve imports, 3: replace imports
vite/packages/vite/src/node/plugins/importAnalysis.ts
Line 273 in ba56cf4
v…