Skip to content

Commit

Permalink
fix: Vite cannot load configuration files in the link directory (#4180)…
Browse files Browse the repository at this point in the history
… (#4181)

Co-authored-by: sapphi-red <[email protected]>
  • Loading branch information
yinzhenyu-su and sapphi-red authored May 13, 2022
1 parent 63ec05a commit a3fa1a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,10 @@ async function loadConfigFromBundledFile(
bundledCode: string
): Promise<UserConfig> {
const extension = path.extname(fileName)
const realFileName = fs.realpathSync(fileName)
const defaultLoader = require.extensions[extension]!
require.extensions[extension] = (module: NodeModule, filename: string) => {
if (filename === fileName) {
if (filename === realFileName) {
;(module as NodeModuleWithCompile)._compile(bundledCode, filename)
} else {
defaultLoader(module, filename)
Expand Down

0 comments on commit a3fa1a3

Please sign in to comment.