1 Star 0 Fork 0

tilamimisu/cesium-webpack-example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.release.config.js 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
sdhani 提交于 2020-07-28 14:54 . updated copy-webpack-plugin syntax
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = [{
mode: 'production',
context: __dirname,
entry: {
app: './src/index.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
node: {
// Resolve node module use of fs
fs: "empty",
Buffer: false,
http: "empty",
https: "empty",
zlib: "empty"
},
resolve: {
mainFields: ['module', 'main']
},
module: {
rules: [{
test: /\.css$/,
use: ['style-loader', { loader: 'css-loader' }],
sideEffects: true
}, {
test: /\.(png|gif|jpg|jpeg|svg|xml|json)$/,
use: ['url-loader']
}, {
// Remove pragmas
test: /\.js$/,
enforce: 'pre',
include: path.resolve(__dirname, 'node_modules/cesium/Source'),
sideEffects: false,
use: [{
loader: 'strip-pragma-loader',
options: {
pragmas: {
debug: false
}
}
}]
}]
},
optimization: {
usedExports: true
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
}),
// Copy Cesium Assets, Widgets, and Workers to a static directory
new CopyWebpackPlugin({
patterns: [
{ from: 'node_modules/cesium/Build/Cesium/Workers', to: 'Workers' },
{ from: 'node_modules/cesium/Build/Cesium/ThirdParty', to: 'ThirdParty' },
{ from: 'node_modules/cesium/Build/Cesium/Assets', to: 'Assets' },
{ from: 'node_modules/cesium/Build/Cesium/Widgets', to: 'Widgets' }
],
}),
new webpack.DefinePlugin({
// Define relative base path in cesium for loading assets
CESIUM_BASE_URL: JSON.stringify('')
})
]
}];
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tilamimisu/cesium-webpack-example.git
git@gitee.com:tilamimisu/cesium-webpack-example.git
tilamimisu
cesium-webpack-example
cesium-webpack-example
master

搜索帮助