代码拉取完成,页面将自动刷新
/**
* @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/') }
])
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。