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: {
|
2020-12-04 00:16:18 +08:00
|
|
|
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",
|
2020-12-16 13:24:36 +08:00
|
|
|
// 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",
|
|
|
|
arch: ["arm64", "x64"],
|
|
|
|
},
|
2021-01-29 21:36:10 +08:00
|
|
|
{
|
|
|
|
target: "zip",
|
2021-01-31 20:40:19 +08:00
|
|
|
arch: ["arm64", "x64"],
|
|
|
|
// arch: ["universal"]
|
2021-01-29 21:36:10 +08:00
|
|
|
},
|
|
|
|
],
|
2021-01-31 20:40:19 +08:00
|
|
|
artifactName: "${productName}-${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-01-29 21:36:10 +08:00
|
|
|
target: ["nsis", "portable"],
|
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-01-29 21:36:10 +08:00
|
|
|
target: ["AppImage", "tar.gz", "deb", "rpm", "snap", "pacman"],
|
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
|
|
|
};
|