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()],
  },

Logo

前往低代码交流专区

更多推荐