const webpack = require('webpack') const path = require('path') const CopyWebpackPlugin = require('copy-webpack-plugin') const cesiumSouce = './node_modules/cesium/Source' const resolve = dir => { return path.join(__dirname, dir) } module.exports = { publicPath: './', outputDir:'emergency-dashboard-jinshui', devServer: { disableHostCheck: true }, chainWebpack: config => { config.resolve.alias .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components')) .set('@c', resolve('src/components')) // key,value自行定义,比如.set('@@', resolve('src/components')) }, productionSourceMap:false, configureWebpack: { // devtool:'cheap-module-eval-source-map' ,//false,//false,//'nosources-source-map', devtool:'cheap-module-source-map' ,//false,//false,//'nosources-source-map', module: { unknownContextCritical: false }, performance: { // hints: false hints: 'warning', // 枚举 false关闭 maxEntrypointSize: 100000000, // 最大入口文件大小 maxAssetSize: 100000000, // 最大资源文件大小 assetFilter: function(assetFilename) { //只给出js文件的性能提示 return assetFilename.endsWith('.js'); } }, plugins: [ new webpack.DefinePlugin({ CESIUM_BASE_URL: JSON.stringify('./') }), new CopyWebpackPlugin([ { from: path.join(cesiumSouce, 'Workers'), to: 'Workers' } ]), new CopyWebpackPlugin([ { from: path.join(cesiumSouce, 'Assets'), to: 'Assets' } ]), new CopyWebpackPlugin([ { from: path.join(cesiumSouce, 'ThirdParty'), to: 'ThirdParty' } ]), new CopyWebpackPlugin([ { from: path.join(cesiumSouce, 'Widgets'), to: 'Widgets' } ]) ] }, pluginOptions: { electronBuilder: { builderOptions: { appId: 'cn.com.elinkit.dashboard.pingyin', productName: 'Pingyin', // 项目名,也是生成的安装文件名 copyright: 'Copyright © 2020 Elink', // 版权信息 // files: ['!Workers/*', '!Assets/*', '!ThirdParty/*', '!Widgets/*'], win: { // win相关配置 target: { target: 'nsis', arch: ['x64'] }, icon: 'public/favicon.ico' // 图标,当前图标在根目录下 }, nsis: { oneClick: false, // 是否一键安装 allowElevation: true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。 allowToChangeInstallationDirectory: true, // 允许修改安装目录 installerIcon: 'public/favicon.ico', // 安装图标 uninstallerIcon: 'public/favicon.ico', //卸载图标 installerHeaderIcon: 'public/favicon.ico', // 安装时头部图标 createDesktopShortcut: true, // 创建桌面图标 createStartMenuShortcut: true, // 创建开始菜单图标 shortcutName: 'KongCun' // 图标名称 }, mac: { icon: 'public/omc.png' } }, outputDir: 'build', // 输出路径 chainWebpackRendererProcess: config => { // Chain webpack config for electron renderer process only // The following example will set IS_ELECTRON to true in your app config.plugin('define').tap(args => { args[0]['IS_ELECTRON'] = true return args }) }, // mainProcessFile: 'electron/main.js' } } }