0
点赞
收藏
分享

微信扫一扫

最新版本vue+cesium配置

ITWYY 2022-03-17 阅读 46

index.vue

import * as Cesium from 'cesium'
import '/node_modules/cesium/Build/Cesium/Widgets/widgets.css'

vue.config.js

const path = require('path')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')

function resolve (dir){
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: '/',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: process.env.NODE_ENV === 'development',
  productionSourceMap: false,
  devServer: {
    port: 9529,
    open: 'http://localhost:9529/',
    client: {
      overlay: {
        errors: true,
        warnings: false,
      },
    }
  },
  configureWebpack:{
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: 'cesium测试',
    resolve: {
      alias: {
        '@': resolve('src')
      }
    },
    plugins: [
      new webpack.DefinePlugin({
        CESIUM_BASE_URL: JSON.stringify('')
      }),
      new CopyWebpackPlugin({
        patterns:[
          { from: 'node_modules/cesium/Build/Cesium/Widgets',to: 'Widgets' },
          { from: 'node_modules/cesium/Build/Cesium/Workers',to: 'Workers' },
          { from: 'node_modules/cesium/Build/Cesium/Assets',to: 'Assets' },
          { from: 'node_modules/cesium/Build/Cesium/ThirdParty',to: 'ThirdParty' },
      ]
    })
    ]
  }
}

举报

相关推荐

0 条评论