fix: fix build && adapte for bugs in NeteasyCloudMusicAPI

This commit is contained in:
代强 2024-03-04 19:22:47 +08:00
parent 1a2c3e2843
commit a18e093d4a
5 changed files with 4439 additions and 4027 deletions

View File

@ -47,6 +47,8 @@
"electron-log": "^4.3.0", "electron-log": "^4.3.0",
"electron-store": "^8.0.1", "electron-store": "^8.0.1",
"electron-updater": "^5.0.1", "electron-updater": "^5.0.1",
"esbuild": "^0.20.1",
"esbuild-loader": "^4.0.3",
"express": "^4.17.1", "express": "^4.17.1",
"express-fileupload": "^1.2.0", "express-fileupload": "^1.2.0",
"express-http-proxy": "^1.6.2", "express-http-proxy": "^1.6.2",
@ -85,11 +87,11 @@
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"prettier": "2.5.1",
"eslint-config-prettier": "^8.1.0", "eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.9.0", "eslint-plugin-vue": "^7.9.0",
"husky": "^4.3.0", "husky": "^4.3.0",
"prettier": "2.5.1",
"sass": "^1.26.11", "sass": "^1.26.11",
"sass-loader": "^10.0.2", "sass-loader": "^10.0.2",
"vue-cli-plugin-electron-builder": "~2.1.1", "vue-cli-plugin-electron-builder": "~2.1.1",

View File

@ -1,8 +1,9 @@
import clc from 'cli-color'; import clc from 'cli-color';
import checkAuthToken from "../utils/checkAuthToken"
import server from 'NeteaseCloudMusicApi/server'; import server from 'NeteaseCloudMusicApi/server';
export async function startNeteaseMusicApi() { export async function startNeteaseMusicApi() {
// Let user know that the service is starting // Let user know that the service is starting
console.log(`${clc.redBright('[NetEase API]')} initiating NCM API`); console.log(`${clc.redBright('[NetEase API]')} initiating NCM API`);
// Load the NCM API. // Load the NCM API.

View File

@ -0,0 +1,8 @@
import os from 'os'
import fs from "fs"
import path from 'path'
// extract from NeteasyCloudMusicAPI/generateConfig.js and avoid bugs in there (generateConfig require main.js but the main.js has bugs)
if (!fs.existsSync(path.resolve(os.tmpdir(), 'anonymous_token'))) {
fs.writeFileSync(path.resolve(os.tmpdir(), 'anonymous_token'), '', 'utf-8')
}

View File

@ -63,6 +63,16 @@ module.exports = {
.loader('node-loader') .loader('node-loader')
.end(); .end();
config.module
.rule('webpack4_es_fallback')
.test(/\.js$/)
.include.add(/node_modules/)
.end()
.use('esbuild-loader')
.loader('esbuild-loader')
.options({ target: 'es2015', format: "cjs" })
.end();
// LimitChunkCountPlugin 可以通过合并块来对块进行后期处理。用以解决 chunk 包太多的问题 // LimitChunkCountPlugin 可以通过合并块来对块进行后期处理。用以解决 chunk 包太多的问题
config.plugin('chunkPlugin').use(webpack.optimize.LimitChunkCountPlugin, [ config.plugin('chunkPlugin').use(webpack.optimize.LimitChunkCountPlugin, [
{ {
@ -169,6 +179,16 @@ module.exports = {
'jsbi', 'jsbi',
path.join(__dirname, 'node_modules/jsbi/dist/jsbi-cjs.js') path.join(__dirname, 'node_modules/jsbi/dist/jsbi-cjs.js')
); );
config.module
.rule('webpack4_es_fallback')
.test(/\.js$/)
.include.add(/node_modules/)
.end()
.use('esbuild-loader')
.loader('esbuild-loader')
.options({ target: 'es2015', format: "cjs" })
.end();
}, },
// 渲染线程的配置文件 // 渲染线程的配置文件
chainWebpackRendererProcess: config => { chainWebpackRendererProcess: config => {

8431
yarn.lock

File diff suppressed because it is too large Load Diff