-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Open
Labels
contribution welcomeenhancementNew feature or requestNew feature or requestp2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)
Description
Describe the bug
If we import something from symlink and the importee is ts file. We counter a such error:
failed to load config from /Users/zheeeng/Workspace/foo/bar/baz/vite.config.ts
error when starting dev server:
TypeError: defaultLoader is not a function
There are two workarounds: compile the ts file to the common js file, or specify the importee path to its real file path rather than symlink.
How could we use it without these two approaches?
Reproduction
https://github.com/zheeeng/test-symlink-vite-config
System Info
Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 1.60 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.0/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
Browsers:
Chrome: 95.0.4638.54
Safari: 14.1.2
Used Package Manager
pnpm
Logs
failed to load config from /Users/zheeeng/Workspace/foo/bar/baz/vite.config.ts
error when starting dev server:
TypeError: defaultLoader is not a function
at Object.require.extensions.<computed> [as .ts] (/Users/zheeeng/Workspace/foo/node_modules/.pnpm/vite@2.6.5_less@4.1.2/node_modules/vite/dist/node/chunks/dep-55830a1a.js:68633:13)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/zheeeng/Workspace/foo/web/studio/vite.config.ts:37:32)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.require.extensions.<computed> [as .ts] (/Users/zheeeng/Workspace/foo/node_modules/.pnpm/vite@2.6.5_less@4.1.2/node_modules/vite/dist/node/chunks/dep-55830a1a.js:68630:20)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- 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 https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
altro3, kazuma1989, zheeeng, fallemand, black7375 and 110 morewizardpisces, zheeeng, steschi, luckylooke, salqueng and 22 more
Metadata
Metadata
Assignees
Labels
contribution welcomeenhancementNew feature or requestNew feature or requestp2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)