You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[vite] connecting...
client:614 [vite] connected.
main.ts:8 Uncaught SyntaxError: The requested module '/node_modules/dayjs/dayjs.min.js?v=4c94d2c5' does not provide an export named 'default' (at main.ts:8:8)
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 vuejs/core instead.
I don't think the parent directory should contain node_modules, which would be confusing
我有个需求需要将其放到node_modules中运行,但是经过长时间排除后,发现了这个问题,很多包都会报错误SyntaxError: The requested module ‘xxxxxx' does not provide an export named 'default'
Describe the bug
在项目的上级目录中只要存在node_modules,那么CommonJS 导入的就无法正常解析
1.在项目中,我导入两个包一个是axios一个是dayjs(在其他项目中导入了其他包也是如此,这里为了最小化展示就导入两个包)
2.当上级目录出现node_modules目录的时候,就如下图所示
3.尝试代码一个不变的将其移到上级总没有node_modules的目录下,就正常运行了
4.由于这是目录问题,无法在stackblitz中提供示例
Reproduction
https://stackblitz.com/edit/vitejs-vite-pcpxok?file=index.html&terminal=dev
Steps to reproduce
1.正常的使用vite安装vue-ts :yarn create vite my-vue-app --template vue-ts
2.导入包dayjs: yarn add dayjs
3. 在main.js中使用dayjs: import dayjs from "dayjs"
4. 正常运行项目:yarn dev
5. 到这里就出现问题了
System Info
Used Package Manager
npm
Logs
[vite] connecting...
client:614 [vite] connected.
main.ts:8 Uncaught SyntaxError: The requested module '/node_modules/dayjs/dayjs.min.js?v=4c94d2c5' does not provide an export named 'default' (at main.ts:8:8)
Validations
The text was updated successfully, but these errors were encountered: