首页 / 浏览问题 / WebGIS / 问题详情
超图FAQ:Vue 3 + Vite + SuerMap iClient构建报错Uncaught TypeError utils.inherits is not a function如何配置?
27,535EXP 2022年11月24日
超图FAQ:Vue 3 + Vite + SuerMap iClient构建报错Uncaught TypeError utils.inherits is not a function如何配置?

1个回答

【问题原因】Elasticsearch本身需要events、util,Webpack5和Vite默认没有这个polyfill的,所以需要自己配置。 【解决方案】 package.json文件中devDependencies配置 "events": "^3.3.0", "util": "^0.12.4" 如下,"devDependencies" : { "@vitejs/plugin-vue" : "^3.3.0" "events": "^3.3.0", "util": "^0.12.4" "vite" : "^2.8.0" } vite.config 文件中配置 define: { 'process.env': {} } 如下, import { defineConfig, loadEnv } from 'vite' import vue from '@vitejs/plugin-vue' // @ts-ignore import path from 'path' export default (mode: string) => defineConfig({ base: './', plugins: [ vue() ], //这里为了iClient for OpenLayers编译添加了配置 define: { 'process.env': {} } })
27,535EXP 2022年11月24日
热门文章
关注我们
...