YesPlayMusic/vue.config.js

170 lines
4.3 KiB
JavaScript
Raw Normal View History

2020-10-10 19:54:44 +08:00
const path = require("path");
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports = {
devServer: {
disableHostCheck: true,
2020-11-23 16:04:45 +08:00
port: process.env.DEV_SERVER_PORT || 8080,
2021-02-15 23:40:09 +08:00
proxy: {
"^/api": {
target: "http://localhost:3000",
changeOrigin: true,
pathRewrite: {
"^/api": "/",
},
},
},
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: {
2021-03-06 23:44:32 +08:00
nodeIntegration: true,
externals: ["@nondanee/unblockneteasemusic", "@njzy/unblockneteasemusic"],
2020-10-24 00:51:29 +08:00
builderOptions: {
2020-11-23 16:04:45 +08:00
productName: "YesPlayMusic",
copyright: "Copyright © YesPlayMusic",
// compression: "maximum", // 机器好的可以打开,配置压缩,开启后会让 .AppImage 格式的客户端启动缓慢
2020-11-23 16:04:45 +08:00
asar: true,
2020-10-30 10:49:22 +08:00
publish: [
{
2020-11-23 16:04:45 +08:00
provider: "github",
owner: "qier222",
repo: "YesPlayMusic",
vPrefixedTagName: true,
releaseType: "draft",
},
2020-10-30 10:49:22 +08:00
],
2020-10-27 23:08:38 +08:00
directories: {
2020-11-23 16:04:45 +08:00
output: "dist_electron",
},
mac: {
2021-01-29 21:36:10 +08:00
target: [
2021-01-31 20:40:19 +08:00
{
target: "dmg",
2021-03-06 23:44:32 +08:00
arch: ["x64", "arm64", "universal"],
2021-01-31 20:40:19 +08:00
},
2021-01-29 21:36:10 +08:00
],
2021-03-07 17:41:57 +08:00
artifactName: "${productName}-${os}-${version}-${arch}.${ext}",
2020-11-23 16:04:45 +08:00
category: "public.app-category.music",
darkModeSupport: true,
2020-10-27 23:08:38 +08:00
},
2020-10-24 00:51:29 +08:00
win: {
2021-03-06 23:44:32 +08:00
target: [
{
target: "portable",
arch: ["x64"],
},
{
target: "nsis",
arch: ["x64"],
2021-03-25 19:29:55 +08:00
deleteAppDataOnUninstall: true,
2021-03-06 23:44:32 +08:00
},
],
2020-11-23 16:04:45 +08:00
publisherName: "YesPlayMusic",
icon: "build/icons/icon.ico",
publish: ["github"],
2020-10-30 10:49:22 +08:00
},
linux: {
2021-03-07 23:40:06 +08:00
target: [
{
target: "AppImage",
arch: ["x64"],
},
{
target: "tar.gz",
arch: ["x64"],
},
{
target: "deb",
2021-03-25 19:29:55 +08:00
arch: ["x64", "armv7l"],
2021-03-07 23:40:06 +08:00
},
{
target: "rpm",
arch: ["x64"],
},
{
target: "snap",
arch: ["x64"],
},
{
target: "pacman",
arch: ["x64"],
},
],
2020-11-23 16:04:45 +08:00
category: "Music",
icon: "./build/icon.icns",
2020-10-30 10:49:22 +08:00
},
2020-11-23 16:04:45 +08:00
dmg: {
icon: "build/icons/icon.icns",
2020-10-24 00:51:29 +08:00
},
nsis: {
oneClick: false,
2020-11-23 16:04:45 +08:00
allowToChangeInstallationDirectory: true,
2021-01-05 22:21:01 +08:00
perMachine: true,
2020-10-27 03:56:05 +08:00
},
2020-10-24 00:51:29 +08:00
},
2020-10-27 23:08:38 +08:00
// 主线程的配置文件
2020-11-23 16:04:45 +08:00
chainWebpackMainProcess: (config) => {
config.plugin("define").tap((args) => {
args[0]["IS_ELECTRON"] = true;
return args;
});
2020-10-27 23:08:38 +08:00
},
2020-10-24 00:51:29 +08:00
// 渲染线程的配置文件
2020-11-23 16:04:45 +08:00
chainWebpackRendererProcess: (config) => {
2020-10-27 23:08:38 +08:00
// 渲染线程的一些其他配置
// Chain webpack config for electron renderer process only
// The following example will set IS_ELECTRON to true in your app
2020-11-23 16:04:45 +08:00
config.plugin("define").tap((args) => {
args[0]["IS_ELECTRON"] = true;
return args;
});
2020-10-27 23:08:38 +08:00
},
2020-10-24 00:51:29 +08:00
// 主入口文件
// mainProcessFile: 'src/main.js',
2020-11-23 16:04:45 +08:00
mainProcessWatch: ["../netease_api/routes.js"],
2020-10-24 00:51:29 +08:00
// mainProcessArgs: []
2020-11-23 16:04:45 +08:00
},
},
2020-10-10 19:54:44 +08:00
};