使用 Vue 3,如何將 path-browserify
加入 vue.config.js?
module.exports = { chainWebpack: config => {} }
編譯時出現以下錯誤:
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 }
Webpack 5 刪除了 Webpack 4 套件中包含的一些內容。
要將其全部還原到 vue3 應用程式中,您可以使用 polyfill 外掛程式。 來自帶有 babel 的普通 create-vue-app:
babel.config.js
vue.config.js
在@Zack的幫助下,使用chainWebpack: