path报错
来源:4-14 业务落地:解析路由表,获取结构化数据
拉塞尔_大华
2024-04-10
报错信息:
ERROR in ./src/utils/route.js 2:0-24
Module not found: Error: Can’t resolve ‘path’ in ‘/Users/wangtang/Desktop/data/learn/imooc-admin/src/utils’
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback ‘resolve.fallback: { “path”: require.resolve(“path-browserify”) }’
- install 'path-browserify’
If you don’t want to include a polyfill, you can use an empty module like this:
resolve.fallback: { “path”: false }
1回答
-
Sunday
2024-04-11
你好
这个问题其实是说 你应该使用 path-browserify 来代替 path 模块。同时需要在 vite.congfig.js 中进行对应的配置。如果不知道具体怎么处理,可以加我的微信:LGD_Sunday 进行沟通
00
相似问题