IssueRaiser

`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

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Sysadmin)

`vite.config.ts` can't import untranspiled ts files from other packages in the same monorepo

zheeengOct 21, 2021, 7:21 AM

### 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.

Comment on this issue