SSR:Error: ENOENT: no such file or directory, open 'xxx/src/views/module.tsx'
See original GitHub issueDescribe the bug
in ssr render fail. error info:
error info
Pre-bundling dependencies:
vue
vue-router
vue-decorator
(this will be run only when your dependencies or config have changed)
[Error: ENOENT: no such file or directory, open 'USERPATH/src/views/module.tsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'USERPATH/src/views/module.tsx'
}
Error: Couldn't resolve component "default" at "/"
at USERPATH/node_modules/vue-router/dist/vue-router.cjs.js:1996:47
at async render (USERPATH/src/entry-server.ts:8:4)
Reproduction
bug store: https://github.com/KellerLong/vue-fix
System Info
windows(wsl 1.0)
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:
npx: installed 1 in 2.328s
System:
OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 3.69 GB / 15.90 GB
Container: Yes
Shell: 5.4.2 - /usr/bin/zsh
Binaries:
Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
Yarn: 1.22.4 - ~/.nvm/versions/node/v12.13.0/bin/yarn
npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
npmPackages:
@vitejs/plugin-vue: ^1.2.1 => 1.2.1
vite: ^2.2.1 => 2.2.1
Used package manager: yarn
Logs
babelHelpers: ‘bundled’ option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packag es/babel#babelhelpers babelHelpers: ‘bundled’ option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packag es/babel#babelhelpers Pre-bundling dependencies: vue vue-router vue-decorator (this will be run only when your dependencies or config have changed) [Error: ENOENT: no such file or directory, open ‘/mnt/c/Users/kevin/Projects/test/vue-fix/src/views/module.tsx’] { errno: -2, code: ‘ENOENT’, syscall: ‘open’, path: ‘/mnt/c/Users/kevin/Projects/test/vue-fix/src/views/module.tsx’ } Error: Couldn’t resolve component “default” at “/” at /mnt/c/Users/kevin/Projects/test/vue-fix/node_modules/vue-router/dist/vue-router.cjs.js:1998:47 at async render (/mnt/c/Users/kevin/Projects/test/vue-fix/src/entry-server.ts:8:10) at async /mnt/c/Users/kevin/Projects/test/vue-fix/server/app.js:36:29
Before submitting the issue, please make sure you do the following
- [ *] 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.
- [ *] Provide a description in this issue that describes the bug.
- [ *] 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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top GitHub Comments
expectation: acceleration,Come on, gogogo
This problem is not the cause of vite, it is the cause of typescript configuration, because jsx-vue does not support decorators and adds typescript and babel plugins. In fact, vite itself supports ts and babel, so you only need to add babel to decorators. Just support it. No need to introduce additional typescript plugins