2021-12-20 18:56:26 +08:00
|
|
|
const path = require('path');
|
2020-10-10 19:54:44 +08:00
|
|
|
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: {
|
2021-12-20 18:56:26 +08:00
|
|
|
'^/api': {
|
|
|
|
target: 'http://localhost:3000',
|
2021-02-15 23:40:09 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
pathRewrite: {
|
2021-12-20 18:56:26 +08:00
|
|
|
'^/api': '/',
|
2021-02-15 23:40:09 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-10-10 19:54:44 +08:00
|
|
|
},
|
|
|
|
pwa: {
|
2021-12-20 18:56:26 +08:00
|
|
|
name: 'YesPlayMusic',
|
2020-10-10 19:54:44 +08:00
|
|
|
iconPaths: {
|
2021-12-20 18:56:26 +08:00
|
|
|
favicon32: 'img/icons/favicon-32x32.png',
|
2020-10-10 19:54:44 +08:00
|
|
|
},
|
2021-12-20 18:56:26 +08:00
|
|
|
themeColor: '#ffffff00',
|
2020-10-10 19:54:44 +08:00
|
|
|
manifestOptions: {
|
2021-12-20 18:56:26 +08:00
|
|
|
background_color: '#335eea',
|
2020-10-10 19:54:44 +08:00
|
|
|
},
|
|
|
|
// workboxOptions: {
|
|
|
|
// swSrc: "dev/sw.js",
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
pages: {
|
|
|
|
index: {
|
2021-12-20 18:56:26 +08:00
|
|
|
entry: 'src/main.js',
|
|
|
|
template: 'public/index.html',
|
|
|
|
filename: 'index.html',
|
|
|
|
title: 'YesPlayMusic',
|
|
|
|
chunks: ['main', 'chunk-vendors', 'chunk-common', 'index'],
|
2020-10-10 19:54:44 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
chainWebpack(config) {
|
2021-12-20 18:56:26 +08:00
|
|
|
config.module.rules.delete('svg');
|
|
|
|
config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end();
|
2020-10-10 19:54:44 +08:00
|
|
|
config.module
|
2021-12-20 18:56:26 +08:00
|
|
|
.rule('icons')
|
2020-10-10 19:54:44 +08:00
|
|
|
.test(/\.svg$/)
|
2021-12-20 18:56:26 +08:00
|
|
|
.include.add(resolve('src/assets/icons'))
|
2020-10-10 19:54:44 +08:00
|
|
|
.end()
|
2021-12-20 18:56:26 +08:00
|
|
|
.use('svg-sprite-loader')
|
|
|
|
.loader('svg-sprite-loader')
|
2020-10-10 19:54:44 +08:00
|
|
|
.options({
|
2021-12-20 18:56:26 +08:00
|
|
|
symbolId: 'icon-[name]',
|
2020-10-10 19:54:44 +08:00
|
|
|
})
|
|
|
|
.end();
|
|
|
|
},
|
2020-10-24 00:51:29 +08:00
|
|
|
// 添加插件的配置
|
|
|
|
pluginOptions: {
|
|
|
|
// electron-builder的配置文件
|
|
|
|
electronBuilder: {
|
2021-03-06 23:44:32 +08:00
|
|
|
nodeIntegration: true,
|
2021-12-20 18:56:26 +08:00
|
|
|
externals: [
|
|
|
|
'@unblockneteasemusic/server',
|
|
|
|
'@unblockneteasemusic/server/src/consts',
|
|
|
|
],
|
2020-10-24 00:51:29 +08:00
|
|
|
builderOptions: {
|
2021-12-20 18:56:26 +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: [
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
provider: 'github',
|
|
|
|
owner: 'qier222',
|
|
|
|
repo: 'YesPlayMusic',
|
2020-11-23 16:04:45 +08:00
|
|
|
vPrefixedTagName: true,
|
2021-12-20 18:56:26 +08:00
|
|
|
releaseType: 'draft',
|
2020-11-23 16:04:45 +08:00
|
|
|
},
|
2020-10-30 10:49:22 +08:00
|
|
|
],
|
2020-10-27 23:08:38 +08:00
|
|
|
directories: {
|
2021-12-20 18:56:26 +08:00
|
|
|
output: 'dist_electron',
|
2020-11-23 16:04:45 +08:00
|
|
|
},
|
|
|
|
mac: {
|
2021-01-29 21:36:10 +08:00
|
|
|
target: [
|
2021-01-31 20:40:19 +08:00
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'dmg',
|
|
|
|
arch: ['x64', 'arm64', 'universal'],
|
2021-01-31 20:40:19 +08:00
|
|
|
},
|
2021-01-29 21:36:10 +08:00
|
|
|
],
|
2021-12-20 18:56:26 +08:00
|
|
|
artifactName: '${productName}-${os}-${version}-${arch}.${ext}',
|
|
|
|
category: 'public.app-category.music',
|
2020-11-23 16:04:45 +08:00
|
|
|
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: [
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'portable',
|
|
|
|
arch: ['x64'],
|
2021-03-06 23:44:32 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'nsis',
|
|
|
|
arch: ['x64'],
|
2021-03-06 23:44:32 +08:00
|
|
|
},
|
|
|
|
],
|
2021-12-20 18:56:26 +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: [
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'AppImage',
|
2022-01-26 20:38:21 +08:00
|
|
|
arch: ['x64'],
|
2021-03-07 23:40:06 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'tar.gz',
|
2022-01-26 18:27:38 +08:00
|
|
|
arch: ['x64', 'arm64'],
|
2021-03-07 23:40:06 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'deb',
|
2022-01-26 18:27:38 +08:00
|
|
|
arch: ['x64', 'armv7l', 'arm64'],
|
2021-03-07 23:40:06 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'rpm',
|
2022-01-26 20:38:21 +08:00
|
|
|
arch: ['x64'],
|
2021-03-07 23:40:06 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'snap',
|
2022-01-26 20:38:21 +08:00
|
|
|
arch: ['x64'],
|
2021-03-07 23:40:06 +08:00
|
|
|
},
|
|
|
|
{
|
2021-12-20 18:56:26 +08:00
|
|
|
target: 'pacman',
|
|
|
|
arch: ['x64'],
|
2021-03-07 23:40:06 +08:00
|
|
|
},
|
|
|
|
],
|
2021-12-20 18:56:26 +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: {
|
2021-12-20 18:56:26 +08:00
|
|
|
icon: 'build/icons/icon.icns',
|
2020-10-24 00:51:29 +08:00
|
|
|
},
|
|
|
|
nsis: {
|
2021-03-25 21:58:47 +08:00
|
|
|
oneClick: true,
|
2021-01-05 22:21:01 +08:00
|
|
|
perMachine: true,
|
2021-03-25 21:58:47 +08:00
|
|
|
deleteAppDataOnUninstall: 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
|
|
|
// 主线程的配置文件
|
2021-12-20 18:56:26 +08:00
|
|
|
chainWebpackMainProcess: config => {
|
|
|
|
config.plugin('define').tap(args => {
|
|
|
|
args[0]['IS_ELECTRON'] = true;
|
2020-11-23 16:04:45 +08:00
|
|
|
return args;
|
|
|
|
});
|
2022-01-30 00:37:12 +08:00
|
|
|
config.resolve.alias.set(
|
|
|
|
'jsbi',
|
|
|
|
path.join(__dirname, 'node_modules/jsbi/dist/jsbi-cjs.js')
|
|
|
|
);
|
2020-10-27 23:08:38 +08:00
|
|
|
},
|
2020-10-24 00:51:29 +08:00
|
|
|
// 渲染线程的配置文件
|
2021-12-20 18:56:26 +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
|
2021-12-20 18:56:26 +08:00
|
|
|
config.plugin('define').tap(args => {
|
|
|
|
args[0]['IS_ELECTRON'] = true;
|
2020-11-23 16:04:45 +08:00
|
|
|
return args;
|
|
|
|
});
|
2020-10-27 23:08:38 +08:00
|
|
|
},
|
2020-10-24 00:51:29 +08:00
|
|
|
// 主入口文件
|
|
|
|
// mainProcessFile: 'src/main.js',
|
|
|
|
// mainProcessArgs: []
|
2020-11-23 16:04:45 +08:00
|
|
|
},
|
|
|
|
},
|
2020-10-10 19:54:44 +08:00
|
|
|
};
|