Skip to content

Commit

Permalink
Merge pull request #2187 from DaiQiangReal/master
Browse files Browse the repository at this point in the history
Fix: Fix build error and  /tmp/anonymous_token not exist.
  • Loading branch information
pan93412 committed Mar 4, 2024
2 parents 1a2c3e2 + 552a1d4 commit ae352f2
Show file tree
Hide file tree
Showing 5 changed files with 4,472 additions and 4,060 deletions.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -47,6 +47,8 @@
"electron-log": "^4.3.0",
"electron-store": "^8.0.1",
"electron-updater": "^5.0.1",
"esbuild": "^0.20.1",
"esbuild-loader": "^4.0.3",
"express": "^4.17.1",
"express-fileupload": "^1.2.0",
"express-http-proxy": "^1.6.2",
Expand Down Expand Up @@ -85,11 +87,11 @@
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"prettier": "2.5.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.9.0",
"husky": "^4.3.0",
"prettier": "2.5.1",
"sass": "^1.26.11",
"sass-loader": "^10.0.2",
"vue-cli-plugin-electron-builder": "~2.1.1",
Expand Down
1 change: 1 addition & 0 deletions src/electron/services.js
@@ -1,4 +1,5 @@
import clc from 'cli-color';
import checkAuthToken from '../utils/checkAuthToken';
import server from 'NeteaseCloudMusicApi/server';

export async function startNeteaseMusicApi() {
Expand Down
8 changes: 8 additions & 0 deletions src/utils/checkAuthToken.js
@@ -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');
}
20 changes: 20 additions & 0 deletions vue.config.js
Expand Up @@ -63,6 +63,16 @@ module.exports = {
.loader('node-loader')
.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 包太多的问题
config.plugin('chunkPlugin').use(webpack.optimize.LimitChunkCountPlugin, [
{
Expand Down Expand Up @@ -169,6 +179,16 @@ module.exports = {
'jsbi',
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 => {
Expand Down

0 comments on commit ae352f2

Please sign in to comment.