vue Can‘t resolve ‘path‘

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.

这句话的意思是webpack 5之前是自动导入node一些核心模块的垫片,现在不导入了,你自己的导入吧!

第一步:

npm i -D path-browserify

第二步(在route.js):

改成:import path from 'path-browserify'

或者:在vue.config.js里面修改

config.resolve.alias.set('path', require.resolve('path-browserify'))

你可能感兴趣的:(前端,javascript,vue.js)