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

时间:2022-01-14 23:18:31

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'