3 Star 0 Fork 1

MY/Cesium3D

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 2.51 KB
一键复制 编辑 原始数据 按行查看 历史
陈宇 提交于 2020-05-27 15:21 . 修改
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = [{
mode: 'development',
context: __dirname,
entry: {
app: './src/index.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
devtool: 'eval',
amd:{
toUrlUndefined: true
},
node: {
// Resolve node module use of fs
fs: "empty",
Buffer: false,
http: "empty",
https: "empty",
zlib: "empty"
},
resolve: {
mainFields: ['module', 'main']
},
module: {
unknownContextCritical: false,
rules: [{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
// {
// test:/\.js$/,
// exclude:/(node_modules|bower_components)/,//排除掉node_module目录
// use:{
// loader:'babel-loader',
// options:{
// presets:['@babel/env'], //转码规则
// // plugins:['transform-runtime']
// }
// }
// },
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: ['url-loader']
},{
test: /\.(png|gif|jpg|jpeg|svg|xml)$/,
use: ['url-loader']
}]
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html'
}),
// Copy Cesium Assets, Widgets, and Workers to a static directory
new CopyWebpackPlugin([{ from: 'node_modules/cesium/Build/Cesium/Workers', to: 'Workers' }]),
new CopyWebpackPlugin([{ from: 'node_modules/cesium/Build/Cesium/ThirdParty', to: 'ThirdParty' }]),
new CopyWebpackPlugin([{ from: 'node_modules/cesium/Build/Cesium/Assets', to: 'Assets' }]),
new CopyWebpackPlugin([{ 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('./')
}),
new webpack.ProvidePlugin({
$:"jquery",
jQuery:"jquery",
"window.jQuery":"jquery"
})
],
// development server options
devServer: {
contentBase: path.join(__dirname, "dist"),
open: true, // 自动打开浏览器
port: 8089, // 端口号
hot:true, //热更新
}
}];
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/MY2651/Cesium3D.git
git@gitee.com:MY2651/Cesium3D.git
MY2651
Cesium3D
Cesium3D
master

搜索帮助