栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

supermap-vue3-leaflet编译过程中出现的问题1

supermap-vue3-leaflet编译过程中出现的问题1

文章目录

导入@supermap/iclient-leaflet ,b编译时出现`BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.`

导入@supermap/iclient-leaflet ,b编译时出现BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.

问题内容:

ERROR in ./node_modules/elasticsearch/src/lib/host.js 11:9-31
Module not found: Error: Can't resolve 'querystring' in 'E:PC_lijin2codingsupermapwebvueleafletLeaflet-masterleaflet_xnode_moduleselasticsearchsrclib'

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: { "querystring": require.resolve("querystring-es3") }'
        - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "querystring": false }


ERROR in ./node_modules/elasticsearch/src/lib/log.js 7:10-24
Module not found: Error: Can't resolve 'url' in 'E:PC_lijin2codingsupermapwebvueleafletLeaflet-masterleaflet_xnode_moduleselasticsearchsrclib'

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: { "url": require.resolve("url/") }'
        - install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "url": false }


ERROR in ./node_modules/elasticsearch/src/lib/utils.js 5:16-31
Module not found: Error: Can't resolve 'util' in 'E:PC_lijin2codingsupermapwebvueleafletLeaflet-masterleaflet_xnode_moduleselasticsearchsrclib'

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: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

解决:

解决报错问题1(只能解决报错,编译时忽略包,但若项目需要依赖包作为运行环境,虽能编译成功,但还是无法支持项目正常运行)

在项目的根目录下的vue.config.js配置文件下配置如下的resolve内容:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack:{
    resolve: {
      fallback: {
        crypto: false,
        url: false,
        querystring: false,
        util: false
      }
    }
  }
})

解决报错问题2(在编译时,将忽略的包也进行编译,同时也需要安装缺失的包),在项目的根目录下的vue.config.js配置文件下配置如下的resolve内容:

npm install querystring-es3
npm install url
npm install elasticsearch #此项可忽略
npm install util
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack:{
    resolve: {
      fallback: {
        //crypto: false,
        // url: false,
        url: require.resolve("url/"),
        // querystring: false,
        querysting: require.resolve("querystring-es3"),
        util: require.resolve("util/")
      }
    }
  }
})
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/775182.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号