1 Star 0 Fork 0

刘博/vue-cesium

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
Caven Chen 提交于 2023-03-26 09:43 . change cesium
/**
* @Author: Caven
* @Date: 2018-12-15 00:33:19
*/
'use strict'
const path = require('path')
const cesiumBuild = './node_modules/cesium/Build/Cesium'
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
let resolve = dir => {
return path.resolve(__dirname, dir)
}
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/dist/' : '/',
productionSourceMap: false,
configureWebpack: {
module: {
unknownContextCritical: false
},
performance: {
hints: false
}
},
chainWebpack: config => {
config.resolve.extensions
.add('.js')
.add('.vue')
.end()
.alias.set('cesium', path.resolve(__dirname, cesiumBuild))
.end()
config.module
.rule('images')
.test(/\.(png|jpe?g|gif)(\?.*)?$/)
.use('url-loader')
.loader('url-loader')
.options({
name: 'images/[name].[ext]',
limit: 10000
})
.end()
config.module
.rule('cesium')
.test(/(\.jsx|\.js)$/)
.include.add(resolve('./node_modules/cesium'))
.end()
.use('babel')
.loader('babel-loader')
.options({
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
browsers: ['> 1%', 'last 2 versions', 'ie >= 10']
}
}
]
],
plugins: ['@babel/plugin-transform-runtime']
})
.end()
config.module
.rule('fonts')
.test(/\.(eot|ttf|woff|woff2)(\?.*)?$/)
.use('url-loader')
.loader('url-loader')
.options({
name: 'fonts/[name].[ext]',
limit: 10000
})
.end()
config.module
.rule('svg')
.exclude.add(resolve('src/assets/svg/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/assets/svg/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
config.plugin('copy').use(CopyWebpackPlugin, [
[
{ from: path.join(cesiumBuild, 'Workers'), to: 'resources/Workers' },
{ from: path.join(cesiumBuild, 'Assets'), to: 'resources/Assets' },
{ from: path.join(cesiumBuild, 'Widgets'), to: 'resources/Widgets' },
{
from: path.join(cesiumBuild, 'ThirdParty'),
to: 'resources/ThirdParty'
}
]
])
config
.plugin('define')
.use(webpack.DefinePlugin, [
{ CESIUM_BASE_URL: JSON.stringify('resources/') }
])
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/null_516_2035/vue-cesium.git
git@gitee.com:null_516_2035/vue-cesium.git
null_516_2035
vue-cesium
vue-cesium
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385