欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

"export 'users' was not found in './data.js'

程序员文章站 2022-06-11 09:34:03
...

data.js

"export 'users' was not found in './data.js'
mock.js
"export 'users' was not found in './data.js'

"export 'users' was not found in './data.js'

"export 'users' was not found in './data.js'

两种解决方案:
1.把data.js末尾的 export default { users } 改为export { users }
"export 'users' was not found in './data.js'

2.删掉data.js末尾的 export default { users }, 然后在开头的const users前面加上 export
(这是模块发编程的语法, 每个js文件都是都可以当作一个模块或者包暴露出去, 然后其他的js文件就可以import这些封装好的模块)
"export 'users' was not found in './data.js'

https://segmentfault.com/q/1010000010912351

相关标签: 解决方案