YesPlayMusic/vue.config.js

172 lines
4.3 KiB
JavaScript
Raw Normal View History

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: {
'^/api': {
target: 'http://localhost:3000',
2021-02-15 23:40:09 +08:00
changeOrigin: true,
pathRewrite: {
'^/api': '/',
2021-02-15 23:40:09 +08:00
},
},
},
2020-10-10 19:54:44 +08:00
},
pwa: {
name: 'YesPlayMusic',
2020-10-10 19:54:44 +08:00
iconPaths: {
favicon32: 'img/icons/favicon-32x32.png',
2020-10-10 19:54:44 +08:00
},
themeColor: '#ffffff00',
2020-10-10 19:54:44 +08:00
manifestOptions: {
background_color: '#335eea',
2020-10-10 19:54:44 +08:00
},
// workboxOptions: {
// swSrc: "dev/sw.js",
// },
},
pages: {
index: {
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) {
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
.rule('icons')
2020-10-10 19:54:44 +08:00
.test(/\.svg$/)
.include.add(resolve('src/assets/icons'))
2020-10-10 19:54:44 +08:00
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
2020-10-10 19:54:44 +08:00
.options({
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,
externals: [
'@unblockneteasemusic/server',
'@unblockneteasemusic/server/src/consts',
],
2020-10-24 00:51:29 +08:00
builderOptions: {
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: [
{
provider: 'github',
owner: 'qier222',
repo: 'YesPlayMusic',
2020-11-23 16:04:45 +08:00
vPrefixedTagName: true,
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: {
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
{
target: 'dmg',
arch: ['x64', 'arm64', 'universal'],
2021-01-31 20:40:19 +08:00
},
2021-01-29 21:36:10 +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: [
{
target: 'portable',
arch: ['x64'],
2021-03-06 23:44:32 +08:00
},
{
target: 'nsis',
arch: ['x64'],
2021-03-06 23:44:32 +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'],
2021-03-07 23:40:06 +08:00
},
{
target: 'tar.gz',
2022-01-26 18:27:38 +08:00
arch: ['x64', 'arm64'],
2021-03-07 23:40:06 +08:00
},
{
target: 'deb',
2022-01-26 18:27:38 +08:00
arch: ['x64', 'armv7l', 'arm64'],
2021-03-07 23:40:06 +08:00
},
{
target: 'rpm',
arch: ['x64'],
2021-03-07 23:40:06 +08:00
},
{
target: 'snap',
arch: ['x64'],
2021-03-07 23:40:06 +08:00
},
{
target: 'pacman',
arch: ['x64'],
2021-03-07 23:40:06 +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: {
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
// 主线程的配置文件
chainWebpackMainProcess: config => {
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
// 渲染线程的配置文件
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
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',
// 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
};