1 Star 0 Fork 1

dvgis/dc-electron

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.96 KB
一键复制 编辑 原始数据 按行查看 历史
Caven Chen 提交于 2021-01-20 10:53 . 升级框架
/**
* @Author: Caven
* @Date: 2021-01-20 10:36:49
*/
'use strict'
const path = require('path')
const fs = require('fs-extra')
const CopywebpackPlugin = require('copy-webpack-plugin')
const dvgis = './node_modules/@dvgis'
let resolve = dir => {
return path.resolve(__dirname, dir)
}
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
productionSourceMap: false,
configureWebpack: {
module: {
unknownContextCritical: false
},
performance: {
hints: false
}
},
chainWebpack: config => {
config.resolve.extensions
.add('.js')
.add('.vue')
.end()
.alias.set('dvgis', resolve(dvgis))
.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('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(__dirname, 'public'),
to: path.join(__dirname, 'dist'),
ignore: ['index.html']
},
{
from: path.join(dvgis, 'dc-sdk/dist/resources'),
to: path.join(__dirname, 'dist', 'libs/dc-sdk/resources')
}
]
])
},
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
chainWebpackMainProcess: config => {
let outputDir = 'dist_electron/bundled'
fs.removeSync(path.join(__dirname, outputDir, 'Assets'))
fs.removeSync(path.join(__dirname, outputDir, 'Workers'))
fs.removeSync(path.join(__dirname, outputDir, 'ThirdParty'))
config.plugin('copy').use(CopywebpackPlugin, [
[
{
from: path.join(__dirname, 'public'),
to: path.join(__dirname, outputDir),
ignore: ['index.html']
},
{
from: path.join(dvgis, 'dc-sdk/dist/resources'),
to: path.join(__dirname, outputDir, 'libs/dc-sdk/resources')
}
]
])
},
chainWebpackRendererProcess: config => {
config.plugin('define').tap(args => {
const env = args[0]['process.env']
for (let key in env) {
args[0][`process.env.${key}`] = env[key]
}
delete args[0]['process.env']
return args
})
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/dvgis/dc-electron.git
git@gitee.com:dvgis/dc-electron.git
dvgis
dc-electron
dc-electron
master

搜索帮助