arcgis-maps-demo/vue.config.js

34 lines
1.1 KiB
JavaScript

const { defineConfig } = require('@vue/cli-service')
//配置@为src的别名
const path = require('path')
function resolve(dir){
return path.join(__dirname,dir)
}
// 配置cesium资源文件
const CopyWebpackPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
let cesiumSource = './node_modules/cesium/Source'
let cesiumWorkers = '../Build/Cesium/Workers'
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave:false,
chainWebpack:(config)=>{
config.resolve.alias
.set("@",resolve('src'))
},
configureWebpack:{
plugins: [
new CopyWebpackPlugin({patterns:[{ from: path.join(cesiumSource, cesiumWorkers), to: 'Workers' }]}),
new CopyWebpackPlugin({patterns:[{ from: path.join(cesiumSource, 'Assets'), to: 'Assets' }]}),
new CopyWebpackPlugin({patterns:[{ from: path.join(cesiumSource, 'Widgets'), to: 'Widgets' }]}),
new CopyWebpackPlugin({patterns:[{ from: path.join(cesiumSource, 'ThirdParty/Workers'), to: 'ThirdParty/Workers' }]}),
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify('./')
})
],
}
})