升级到 webpack 5
parent
d6f87894aa
commit
b8250b67c9
|
@ -34,7 +34,6 @@ module.exports = merge(baseConfig, {
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: 'named',
|
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin(),
|
new TerserPlugin(),
|
||||||
new OptimizeCSSAssetsPlugin({}),
|
new OptimizeCSSAssetsPlugin({}),
|
||||||
|
|
|
@ -34,7 +34,6 @@ module.exports = merge(baseConfig, {
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
optimization: {
|
optimization: {
|
||||||
chunkIds: 'named',
|
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin(),
|
new TerserPlugin(),
|
||||||
new OptimizeCSSAssetsPlugin({}),
|
new OptimizeCSSAssetsPlugin({}),
|
||||||
|
|
|
@ -2,8 +2,6 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
const cssLoaderConfig = require('./css-loader.config')
|
const cssLoaderConfig = require('./css-loader.config')
|
||||||
const chalk = require('chalk')
|
const chalk = require('chalk')
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'development'
|
|
||||||
|
|
||||||
// merge css-loader
|
// merge css-loader
|
||||||
exports.mergeCSSLoader = beforeLoader => {
|
exports.mergeCSSLoader = beforeLoader => {
|
||||||
const loader = [
|
const loader = [
|
||||||
|
@ -11,12 +9,7 @@ exports.mergeCSSLoader = beforeLoader => {
|
||||||
{
|
{
|
||||||
resourceQuery: /module/,
|
resourceQuery: /module/,
|
||||||
use: [
|
use: [
|
||||||
{
|
MiniCssExtractPlugin.loader,
|
||||||
loader: MiniCssExtractPlugin.loader,
|
|
||||||
options: {
|
|
||||||
hmr: isDev,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: cssLoaderConfig,
|
options: cssLoaderConfig,
|
||||||
|
@ -27,12 +20,7 @@ exports.mergeCSSLoader = beforeLoader => {
|
||||||
// 这里匹配普通的 `<style>` 或 `<style scoped>`
|
// 这里匹配普通的 `<style>` 或 `<style scoped>`
|
||||||
{
|
{
|
||||||
use: [
|
use: [
|
||||||
{
|
MiniCssExtractPlugin.loader,
|
||||||
loader: MiniCssExtractPlugin.loader,
|
|
||||||
options: {
|
|
||||||
hmr: isDev,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'css-loader',
|
'css-loader',
|
||||||
'postcss-loader',
|
'postcss-loader',
|
||||||
],
|
],
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
|
@ -53,9 +53,9 @@
|
||||||
"clean:electron": "rimraf dist/electron",
|
"clean:electron": "rimraf dist/electron",
|
||||||
"clean": "rimraf dist && rimraf build",
|
"clean": "rimraf dist && rimraf build",
|
||||||
"build:src": "node build-config/pack.js",
|
"build:src": "node build-config/pack.js",
|
||||||
"build:main": "cross-env NODE_ENV=production webpack --config build-config/main/webpack.config.prod.js --progress --hide-modules",
|
"build:main": "cross-env NODE_ENV=production webpack --config build-config/main/webpack.config.prod.js --progress",
|
||||||
"build:renderer": "cross-env NODE_ENV=production webpack --config build-config/renderer/webpack.config.prod.js --progress --hide-modules",
|
"build:renderer": "cross-env NODE_ENV=production webpack --config build-config/renderer/webpack.config.prod.js --progress",
|
||||||
"build:renderer-lyric": "cross-env NODE_ENV=production webpack --config build-config/renderer-lyric/webpack.config.prod.js --progress --hide-modules",
|
"build:renderer-lyric": "cross-env NODE_ENV=production webpack --config build-config/renderer-lyric/webpack.config.prod.js --progress",
|
||||||
"build": "npm run clean:electron && npm run build:main && npm run build:renderer && npm run build:renderer-lyric",
|
"build": "npm run clean:electron && npm run build:main && npm run build:renderer && npm run build:renderer-lyric",
|
||||||
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly src",
|
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly src",
|
||||||
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly --fix src",
|
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly --fix src",
|
||||||
|
@ -169,10 +169,10 @@
|
||||||
"cfonts": "^2.9.1",
|
"cfonts": "^2.9.1",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"changelog-parser": "^2.8.0",
|
"changelog-parser": "^2.8.0",
|
||||||
"copy-webpack-plugin": "^6.4.1",
|
"copy-webpack-plugin": "^8.1.0",
|
||||||
"core-js": "^3.10.0",
|
"core-js": "^3.10.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"css-loader": "^4.3.0",
|
"css-loader": "^5.2.0",
|
||||||
"del": "^6.0.0",
|
"del": "^6.0.0",
|
||||||
"electron": "^9.4.4",
|
"electron": "^9.4.4",
|
||||||
"electron-builder": "^22.10.5",
|
"electron-builder": "^22.10.5",
|
||||||
|
@ -189,14 +189,15 @@
|
||||||
"eslint-plugin-standard": "^4.1.0",
|
"eslint-plugin-standard": "^4.1.0",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||||
"html-webpack-plugin": "^4.5.2",
|
"html-webpack-plugin": "^5.3.1",
|
||||||
"less": "^3.13.1",
|
"less": "^4.1.1",
|
||||||
"less-loader": "^7.3.0",
|
"less-loader": "^8.0.0",
|
||||||
"markdown-it": "^12.0.4",
|
"markdown-it": "^12.0.4",
|
||||||
"mini-css-extract-plugin": "^0.12.0",
|
"mini-css-extract-plugin": "^1.4.0",
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.4",
|
"optimize-css-assets-webpack-plugin": "^5.0.4",
|
||||||
"postcss-loader": "^4.2.0",
|
"postcss": "^8.2.9",
|
||||||
"postcss-pxtorem": "^5.1.1",
|
"postcss-loader": "^5.2.0",
|
||||||
|
"postcss-pxtorem": "^6.0.0",
|
||||||
"pug": "^3.0.2",
|
"pug": "^3.0.2",
|
||||||
"pug-loader": "^2.4.0",
|
"pug-loader": "^2.4.0",
|
||||||
"pug-plain-loader": "^1.1.0",
|
"pug-plain-loader": "^1.1.0",
|
||||||
|
@ -204,13 +205,13 @@
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"spinnies": "^0.5.1",
|
"spinnies": "^0.5.1",
|
||||||
"stylus": "^0.54.8",
|
"stylus": "^0.54.8",
|
||||||
"stylus-loader": "^4.3.3",
|
"stylus-loader": "^5.0.0",
|
||||||
"terser-webpack-plugin": "^4.2.3",
|
"terser-webpack-plugin": "^5.1.1",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
"vue-loader": "^15.9.6",
|
"vue-loader": "^15.9.6",
|
||||||
"vue-template-compiler": "^2.6.12",
|
"vue-template-compiler": "^2.6.12",
|
||||||
"webpack": "^4.46.0",
|
"webpack": "^5.30.0",
|
||||||
"webpack-cli": "^3.3.12",
|
"webpack-cli": "^4.6.0",
|
||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.2",
|
||||||
"webpack-hot-middleware": "^2.25.0",
|
"webpack-hot-middleware": "^2.25.0",
|
||||||
"webpack-merge": "^5.7.3"
|
"webpack-merge": "^5.7.3"
|
||||||
|
|
|
@ -4,7 +4,7 @@ const path = require('path')
|
||||||
// 单例应用程序
|
// 单例应用程序
|
||||||
if (!app.requestSingleInstanceLock()) {
|
if (!app.requestSingleInstanceLock()) {
|
||||||
app.quit()
|
app.quit()
|
||||||
return
|
process.exit(0)
|
||||||
}
|
}
|
||||||
if (!global.modules) global.modules = {}
|
if (!global.modules) global.modules = {}
|
||||||
app.on('second-instance', (event, argv, cwd) => {
|
app.on('second-instance', (event, argv, cwd) => {
|
||||||
|
|
Loading…
Reference in New Issue