YesPlayMusic/vue.config.js

106 lines
3.1 KiB
JavaScript
Raw Normal View History

2020-10-10 19:54:44 +08:00
const path = require("path");
2020-10-27 23:08:38 +08:00
const CopyPlugin = require('copy-webpack-plugin')
2020-10-10 19:54:44 +08:00
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports = {
devServer: {
disableHostCheck: true,
port: process.env.DEV_SERVER_PORT || 8080
2020-10-10 19:54:44 +08:00
},
pwa: {
name: "YesPlayMusic",
iconPaths: {
favicon32: "img/icons/favicon-32x32.png",
},
themeColor: "#ffffff00",
manifestOptions: {
background_color: "#335eea",
},
// workboxOptions: {
// swSrc: "dev/sw.js",
// },
},
pages: {
index: {
entry: "src/main.js",
template: "public/index.html",
filename: "index.html",
title: "YesPlayMusic",
2020-10-24 00:51:29 +08:00
chunks: ["main", "chunk-vendors", "chunk-common", "index"],
2020-10-10 19:54:44 +08:00
},
},
chainWebpack(config) {
config.module.rules.delete("svg");
2020-10-22 19:17:20 +08:00
config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
2020-10-10 19:54:44 +08:00
config.module
.rule("icons")
.test(/\.svg$/)
.include.add(resolve("src/assets/icons"))
.end()
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.options({
symbolId: "icon-[name]",
})
.end();
},
2020-10-24 00:51:29 +08:00
// 添加插件的配置
pluginOptions: {
// electron-builder的配置文件
electronBuilder: {
2020-10-27 23:08:38 +08:00
preload: 'src/electron/preload.js',
2020-10-24 00:51:29 +08:00
builderOptions: {
// 应用名称
productName: 'Yes Play Music',
// 版权
copyright: 'Copyright © YesPlayMusic',
compression: "maximum",
2020-10-27 23:08:38 +08:00
publish: ["github"],
// Compress app using 'electron/asar'
2020-10-24 00:51:29 +08:00
asar: true,
2020-10-27 23:08:38 +08:00
// 项目打包生成的文件目录
directories: {
output: 'dist_electron'
},
// window 的 icon 头标
2020-10-24 00:51:29 +08:00
win: {
2020-10-29 23:33:11 +08:00
icon: 'public/img/icons/512x512.png'
2020-10-24 00:51:29 +08:00
},
// 是否静默安装
nsis: {
2020-10-27 23:08:38 +08:00
// 是否一键安装,建议为 false可以让用户点击下一步、下一步、下一步的形式安装程序如果为true当用户双击构建好的程序自动安装程序并打开一键安装
2020-10-24 00:51:29 +08:00
oneClick: false,
2020-10-27 23:08:38 +08:00
// 允许修改安装目录,建议为 true是否允许用户改变安装目录默认是不允许
2020-10-24 00:51:29 +08:00
allowToChangeInstallationDirectory: true
2020-10-27 03:56:05 +08:00
},
// 集成 nodejs, https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration
// nodeIntegration: true
2020-10-24 00:51:29 +08:00
},
2020-10-27 23:08:38 +08:00
// 主线程的配置文件
2020-10-27 03:56:05 +08:00
chainWebpackMainProcess: config => {
2020-10-27 23:08:38 +08:00
config.plugin('define').tap((args) => {
args[0]['IS_ELECTRON'] = true
return args
})
},
2020-10-24 00:51:29 +08:00
// 渲染线程的配置文件
2020-10-27 23:08:38 +08:00
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
})
},
2020-10-24 00:51:29 +08:00
// 主入口文件
// mainProcessFile: 'src/main.js',
2020-10-27 23:08:38 +08:00
mainProcessWatch: ['../napi/routes.js'],
2020-10-24 00:51:29 +08:00
// mainProcessArgs: []
}
2020-10-27 23:08:38 +08:00
}
2020-10-10 19:54:44 +08:00
};