为什么vue用cesium比原生vue界面要暗淡一些

发布网友 发布时间:2022-04-20 03:59

我来回答

1个回答

热心网友 时间:2022-04-23 01:10

webpack.base.conf.js

添加代码
const CopyWebpackPlugin = require('copy-webpack-plugin')
// The path to the Cesium source code
const cesiumSource = path.resolve(__dirname, '../node_moles/cesium/Source')
const cesiumWorkers = '../Build/Cesium/Workers'
output: {
    // Needed to compile multiline strings in Cesium
    sourcePrefix: '',
}
alias: {
// Cesium mole name
'cesium': path.resolve(__dirname, cesiumSource),
}
mole: {
unknownContextCritical: false,
rules: [
    {
    test: /\.js$/,
    loader: 'babel-loader',
     include: [resolve('src'), resolve('test'),resolve('node_moles/webpack-dev-server/client')]
    }
 ]
}
plugins: [
    // Copy Cesium Assets, Widgets, and Workers to a static directory
    new CopyWebpackPlugin([      {
        //from: path.join(cesiumSource, 'Workers'),
        from: path.join(cesiumSource, cesiumWorkers),
        to: 'Workers'      }    ]),
    new CopyWebpackPlugin([      {
        from: path.join(cesiumSource, 'Assets'),
        to: 'Assets'      }    ]),
    new CopyWebpackPlugin([      {
        from: path.join(cesiumSource, 'Widgets'),
        to: 'Widgets'      }    ]),
]
webpack.dev.conf.js
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
devServer: {
    // historyApiFallback: true
        historyApiFallback: {      rewrites: [        { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },      ],    },
        contentBase: config.build.assetsRoot, // for Cesium
}
plugins: [
    new webpack.DefinePlugin({
    'process.env': require('../config/dev.env'),
    // Define relative base path in cesium for loading assets         
     CESIUM_BASE_URL: JSON.stringify('/')    }),
    // copy custom static assets
    new CopyWebpackPlugin([      {        from: path.resolve(__dirname, '../static'),        to: config.dev.assetsSubDirectory,        ignore: ['.*']      }    ]),
]

声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com