From 30904edfa1ff87b3f3c09ae55e2a2cd5c9e04e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E8=BF=9B=E7=A6=84?= Date: Mon, 7 Mar 2022 16:11:31 +0800 Subject: [PATCH] =?UTF-8?q?webpack=20=E6=89=93=E5=8C=85=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/yilia/package-lock.json | 84 ++++++++++++++++++++++++++++------ themes/yilia/package.json | 2 +- themes/yilia/webpack.config.js | 14 +++--- 3 files changed, 78 insertions(+), 22 deletions(-) diff --git a/themes/yilia/package-lock.json b/themes/yilia/package-lock.json index 0f05c6f..c3d3b38 100644 --- a/themes/yilia/package-lock.json +++ b/themes/yilia/package-lock.json @@ -24,7 +24,7 @@ "axios": "^0.21.1", "babel-loader": "8.2.3", "clean-webpack-plugin": "^4.0.0", - "css-loader": "^6.7.0", + "css-loader": "^5.2.7", "file-loader": "^6.2.0", "html-webpack-plugin": "^5.5.0", "mini-css-extract-plugin": "^2.6.0", @@ -3129,29 +3129,63 @@ } }, "node_modules/css-loader": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.0.tgz", - "integrity": "sha512-S7HCfCiDHLA+VXKqdZwyRZgoO0R9BnKDnVIoHMq5grl3N86zAu7MB+FBWHr5xOJC8SmvpTLha/2NpfFkFEN/ig==", + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.2.7.tgz", + "integrity": "sha512-Q7mOvpBNBG7YrVGMxRxcBJZFL75o+cH2abNASdibkj/fffYD8qWbInZrD0S9ccI6vZclF3DsHE7njGlLtaHbhg==", "dev": true, "dependencies": { "icss-utils": "^5.1.0", - "postcss": "^8.4.7", + "loader-utils": "^2.0.0", + "postcss": "^8.2.15", "postcss-modules-extract-imports": "^3.0.0", "postcss-modules-local-by-default": "^4.0.0", "postcss-modules-scope": "^3.0.0", "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.2.0", + "postcss-value-parser": "^4.1.0", + "schema-utils": "^3.0.0", "semver": "^7.3.5" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 10.13.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^5.0.0" + "webpack": "^4.27.0 || ^5.0.0" + } + }, + "node_modules/css-loader/node_modules/loader-utils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", + "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "dev": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, + "node_modules/css-loader/node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, "node_modules/css-loader/node_modules/semver": { @@ -10126,21 +10160,45 @@ "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" }, "css-loader": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.0.tgz", - "integrity": "sha512-S7HCfCiDHLA+VXKqdZwyRZgoO0R9BnKDnVIoHMq5grl3N86zAu7MB+FBWHr5xOJC8SmvpTLha/2NpfFkFEN/ig==", + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.2.7.tgz", + "integrity": "sha512-Q7mOvpBNBG7YrVGMxRxcBJZFL75o+cH2abNASdibkj/fffYD8qWbInZrD0S9ccI6vZclF3DsHE7njGlLtaHbhg==", "dev": true, "requires": { "icss-utils": "^5.1.0", - "postcss": "^8.4.7", + "loader-utils": "^2.0.0", + "postcss": "^8.2.15", "postcss-modules-extract-imports": "^3.0.0", "postcss-modules-local-by-default": "^4.0.0", "postcss-modules-scope": "^3.0.0", "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.2.0", + "postcss-value-parser": "^4.1.0", + "schema-utils": "^3.0.0", "semver": "^7.3.5" }, "dependencies": { + "loader-utils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", + "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", diff --git a/themes/yilia/package.json b/themes/yilia/package.json index 0308391..8cbeabe 100644 --- a/themes/yilia/package.json +++ b/themes/yilia/package.json @@ -33,7 +33,7 @@ "axios": "^0.21.1", "babel-loader": "8.2.3", "clean-webpack-plugin": "^4.0.0", - "css-loader": "^6.7.0", + "css-loader": "^5.2.7", "file-loader": "^6.2.0", "html-webpack-plugin": "^5.5.0", "mini-css-extract-plugin": "^2.6.0", diff --git a/themes/yilia/webpack.config.js b/themes/yilia/webpack.config.js index 30b9aea..6060282 100644 --- a/themes/yilia/webpack.config.js +++ b/themes/yilia/webpack.config.js @@ -31,7 +31,7 @@ module.exports = function(env, argv) { }, output: { publicPath: '/', - path: __dirname+'/source', + path: __dirname + '/source', filename: isProd ? 'js/[name].[chunkhash].js' : 'js/[name].js' }, module: { @@ -56,23 +56,21 @@ module.exports = function(env, argv) { use: { loader: 'file-loader', options: { - name: '[name].[ext]', + name: '[name].[contenthash:6].[ext]', outputPath: 'images', esModule: false // 不使用es6的模块语法 } - }, - type: 'javascript/auto' // 默认使用自定义的 + } },{ test: /\.(svg|eot|ttf|woff2?|otf)$/, use: { loader: 'file-loader', options: { - name: '[name].[fullhash:6].[ext]', + name: '[name].[contenthash:6].[ext]', outputPath: 'fonts', esModule: false // 不使用es6的模块语法 } - }, - type: 'javascript/auto' // 默认使用自定义的 + } } ] }, @@ -91,7 +89,7 @@ module.exports = function(env, argv) { dry: false, }), new MiniCssExtractPlugin({ - filename: 'css/[name].[fullhash:6].css' + filename: 'css/[name].[contenthash:6].css' }) ], mode: argv.mode,