0 Star 1 Fork 0

lizeping/cesium-heatmap-es6

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
craco.config.js 2.84 KB
一键复制 编辑 原始数据 按行查看 历史
pczheng 提交于 2022-01-27 00:05 . init frame
const webpack = require('webpack');
const CracoLessPlugin = require('craco-less');
const isEnvProduction = process.env.NODE_ENV === "production";
const CompressionWebpackPlugin = require("compression-webpack-plugin");
// const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer")
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const plugins = [
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify('./Cesium/')
})]
if (isEnvProduction) {
plugins.push(new CompressionWebpackPlugin({
test: /\.(css|js)$/,
// 只处理比1kb大的资源
threshold: 1024,
// 只处理压缩率低于90%的文件
minRatio: 0.9
}))
} else {
// plugins.push(new BundleAnalyzerPlugin())
plugins.push(new CopyWebpackPlugin({
patterns: [
{ from: 'node_modules/cesium/Build/Cesium', to: 'Cesium' },
],
}))
}
module.exports = {
webpack: {
plugins,
configure: (config) => {
config.entry = ['./src/index.tsx']
const markdown = {
test: /\.md$/,
use: [
{
loader: require.resolve("html-loader")
},
{
loader: require.resolve('markdown-loader'),
}]
}
config.module.rules[1].oneOf.unshift(markdown)
//移除cesium警告
config.module.unknownContextCritical = false
config.module.unknownContextRegExp = /\/cesium\/cesium\/Source\/Core\/buildModuleUrl\.js/
config.externals = [{
'cesium': 'Cesium',
},]
config.optimization = {
minimizer: [new TerserPlugin({
extractComments: false,
})],
}
return config
}
},
devServer: (devServerConfig) => {
devServerConfig.proxy = {
'/3dtiles': { target: 'https://data1.mars3d.cn', secure: false, changeOrigin: true, },
'/terrain': { target: 'http://data.marsgis.cn', secure: false, changeOrigin: true, },
'/realspace/services/': { target: 'http://www.supermapol.com', secure: false, changeOrigin: true, },
'/iserver/services/': { target: 'http://support.supermap.com.cn:8090', secure: false, changeOrigin: true, },
}
return devServerConfig;
},
plugins: [{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
// '@primary-color': '#73ffff'
'@font-size-base': '16px'
},
javascriptEnabled: true,
},
},
},
}],
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/kesai/cesium-heatmap-es6.git
git@gitee.com:kesai/cesium-heatmap-es6.git
kesai
cesium-heatmap-es6
cesium-heatmap-es6
main

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385