`vite.config.ts` can't import untranspiled ts files from other packages in the same monorepo
### 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 ```shell 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 (int
Posted by zheeeng on Oct 21, 2021, 7:21 AM
Tags
Related issues
- Custom games stuck on "finding server" for all european servers
- Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
- Forza Horizon 6 (2483190)
- Turn off integrated browser for default
- Weekly updates are too frequent
- [BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
github (Sysadmin)
Custom games stuck on "finding server" for all european servers
Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
Forza Horizon 6 (2483190)
Turn off integrated browser for default
Weekly updates are too frequent
[BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Add gemini-3.1-pro-preview
[TF2] Feature request: Bring Back Quickplay
`vite.config.ts` can't import untranspiled ts files from other packages in the same monorepo
### 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 ```shell 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 (int
Comments (0)
No comments yet. Start the discussion.