webpack < 5 used to include polyfills for node.js core modules by default.
vue-cli5.x 版本 报错在vue-cli新版本中使用了 pdfh5 然后报错如下, 大致意思是说 新版的cli 中模块polyfill不会自动引入了If you want to include a polyfill, you need to:- add a fallback 'resolve.fallback: { "https": require.resolve("https-brows
·
vue-cli5.x 版本 报错
在vue-cli新版本中使用了 pdfh5 然后报错如下, 大致意思是说 新版的cli 中模块polyfill不会自动引入了
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
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: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
尝试安装如下依赖
cnpm install node-polyfill-webpack-plugin
yarn add crypto-browserify
然后在vue.config.js中添加
configureWebpack: {
resolve: {
fallback: {
fs: false,
crypto: require.resolve("crypto-browserify")
}
},
plugins: [new NodePolyfillPlugin()],
},
更多推荐
已为社区贡献6条内容
所有评论(0)