mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-24 16:55:07 +01:00
bump webpack version adn config
This commit is contained in:
parent
b5b8d2931a
commit
c5b71eddba
35
package.json
35
package.json
@ -24,35 +24,34 @@
|
|||||||
"browserslist": "^4.0.1",
|
"browserslist": "^4.0.1",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"clipboard": "^2.0.4",
|
"clipboard": "^2.0.4",
|
||||||
"css-loader": "^4.2.2",
|
"css-loader": "^5.1.3",
|
||||||
"cssnano": "^4.1.8",
|
"cssnano": "^5.0.8",
|
||||||
"eslint-config-airbnb": "^18.2.0",
|
"eslint-config-airbnb": "^18.2.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^8.1.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
|
||||||
"file-loader": "^6.1.0",
|
"file-loader": "^6.1.0",
|
||||||
"html-webpack-plugin": "^4.4.1",
|
"html-webpack-plugin": "^4.4.1",
|
||||||
"husky": "^4.2.5",
|
"husky": "^5.1.3",
|
||||||
"mini-css-extract-plugin": "^0.11.0",
|
"mini-css-extract-plugin": "^1.3.9",
|
||||||
"postcss": "^8.2.10",
|
"postcss": "^8.2.10",
|
||||||
"postcss-browser-reporter": "^0.6.0",
|
"postcss-browser-reporter": "^0.6.0",
|
||||||
"postcss-cli": "^7.1.2",
|
"postcss-cli": "^8.3.1",
|
||||||
"postcss-import": "^12.0.1",
|
"postcss-color-function": "^4.0.1",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-color-mod-function": "^3.0.3",
|
||||||
"postcss-mixins": "^6.2.1",
|
"postcss-import": "^14.0.0",
|
||||||
"postcss-nested": "^4.2.3",
|
"postcss-loader": "^5.2.0",
|
||||||
|
"postcss-mixins": "^7.0.3",
|
||||||
|
"postcss-nested": "^5.0.5",
|
||||||
"postcss-preset-env": "^6.7.0",
|
"postcss-preset-env": "^6.7.0",
|
||||||
"postcss-reporter": "^6.0.1",
|
"postcss-reporter": "^7.0.2",
|
||||||
"postcss-url": "^8.0.0",
|
"postcss-url": "^10.1.3",
|
||||||
"prettier": "^2.1.1",
|
|
||||||
"prettier-eslint-cli": "^5.0.0",
|
"prettier-eslint-cli": "^5.0.0",
|
||||||
"prettier-plugin-go-template": "^0.0.9",
|
|
||||||
"ramda": "^0.27.1",
|
"ramda": "^0.27.1",
|
||||||
"style-loader": "^1.2.1",
|
"style-loader": "^1.2.1",
|
||||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
"terser-webpack-plugin": "^5.2.4",
|
||||||
"url-loader": "^4.1.0",
|
"url-loader": "^4.1.0",
|
||||||
"webpack": "^4.29.3",
|
"webpack": "^5.27.1",
|
||||||
"webpack-cli": "^3.2.3"
|
"webpack-cli": "^4.5.0"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
@ -1 +1,7 @@
|
|||||||
!function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,n){n(1),e.exports=n(2)},function(e,t){function n(){return window.matchMedia(l).matches}function o(){c&&c.classList.toggle("hidden",!n()),i&&i.classList.toggle("hidden",n()),u&&u.classList.toggle("hidden",!n())}var r=document.querySelector(".container"),i=document.querySelector(".menu"),c=document.querySelector(".menu-trigger"),d=(document.querySelector(".menu__inner--desktop"),document.querySelector(".menu__sub-inner-more-trigger")),u=document.querySelector(".menu__sub-inner-more"),l=getComputedStyle(document.body).getPropertyValue("--phoneWidth");i&&i.addEventListener("click",function(e){return e.stopPropagation()}),u&&u.addEventListener("click",function(e){return e.stopPropagation()}),o(),document.body.addEventListener("click",function(){n()||!u||u.classList.contains("hidden")?n()&&!i.classList.contains("hidden")&&i.classList.add("hidden"):u.classList.add("hidden")}),window.addEventListener("resize",o),c&&c.addEventListener("click",function(e){e.stopPropagation(),i&&i.classList.toggle("hidden")}),d&&d.addEventListener("click",function(e){e.stopPropagation(),u&&u.classList.toggle("hidden"),u&&u.getBoundingClientRect().right>r.getBoundingClientRect().right&&(u.style.left="auto",u.style.right=0)})},function(e,t){var n=window.localStorage&&window.localStorage.getItem("theme"),o=document.querySelector(".theme-toggle"),r="dark"===n;null!==n&&document.body.classList.toggle("dark-theme",r),o.addEventListener("click",function(){document.body.classList.toggle("dark-theme"),window.localStorage&&window.localStorage.setItem("theme",document.body.classList.contains("dark-theme")?"dark":"light")})}]);
|
(function(){var __webpack_modules__={"./assets/js/menu.js":
|
||||||
|
/*!***************************!*\
|
||||||
|
!*** ./assets/js/menu.js ***!
|
||||||
|
\***************************/function(){eval('var container = document.querySelector(".container");\nvar menu = document.querySelector(".menu");\nvar mobileMenuTrigger = document.querySelector(".menu-trigger");\nvar desktopMenu = document.querySelector(".menu__inner--desktop");\nvar desktopMenuTrigger = document.querySelector(".menu__sub-inner-more-trigger");\nvar menuMore = document.querySelector(".menu__sub-inner-more");\nvar mobileQuery = getComputedStyle(document.body).getPropertyValue("--phoneWidth");\n\nvar isMobile = function isMobile() {\n return window.matchMedia(mobileQuery).matches;\n};\n\nvar isMobileMenu = function isMobileMenu() {\n mobileMenuTrigger && mobileMenuTrigger.classList.toggle("hidden", !isMobile());\n menu && menu.classList.toggle("hidden", isMobile());\n menuMore && menuMore.classList.toggle("hidden", !isMobile());\n}; // Common\n\n\nmenu && menu.addEventListener("click", function (e) {\n return e.stopPropagation();\n});\nmenuMore && menuMore.addEventListener("click", function (e) {\n return e.stopPropagation();\n});\nisMobileMenu();\ndocument.body.addEventListener("click", function () {\n if (!isMobile() && menuMore && !menuMore.classList.contains("hidden")) {\n menuMore.classList.add("hidden");\n } else if (isMobile() && !menu.classList.contains("hidden")) {\n menu.classList.add("hidden");\n }\n});\nwindow.addEventListener("resize", isMobileMenu); // Mobile menu\n\nmobileMenuTrigger && mobileMenuTrigger.addEventListener("click", function (e) {\n e.stopPropagation();\n menu && menu.classList.toggle("hidden");\n}); // Desktop menu\n\ndesktopMenuTrigger && desktopMenuTrigger.addEventListener("click", function (e) {\n e.stopPropagation();\n menuMore && menuMore.classList.toggle("hidden");\n\n if (menuMore && menuMore.getBoundingClientRect().right > container.getBoundingClientRect().right) {\n menuMore.style.left = "auto";\n menuMore.style.right = 0;\n }\n});\n\n//# sourceURL=webpack://hello-friend/./assets/js/menu.js?')},"./assets/js/theme.js":
|
||||||
|
/*!****************************!*\
|
||||||
|
!*** ./assets/js/theme.js ***!
|
||||||
|
\****************************/function(){eval('// Toggle theme\nvar getTheme = window.localStorage && window.localStorage.getItem("theme");\nvar themeToggle = document.querySelector(".theme-toggle");\nvar isDark = getTheme === "dark";\n\nif (getTheme !== null) {\n document.body.classList.toggle("dark-theme", isDark);\n}\n\nthemeToggle.addEventListener("click", function () {\n document.body.classList.toggle("dark-theme");\n window.localStorage && window.localStorage.setItem("theme", document.body.classList.contains("dark-theme") ? "dark" : "light");\n});\n\n//# sourceURL=webpack://hello-friend/./assets/js/theme.js?')}};__webpack_modules__["./assets/js/menu.js"]();var __webpack_exports__={};__webpack_modules__["./assets/js/theme.js"]()})();
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,14 +1,12 @@
|
|||||||
const Webpack = require("webpack");
|
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
||||||
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const join = (...paths) => path.join(__dirname, ...paths);
|
const join = (...paths) => path.join(__dirname, ...paths);
|
||||||
|
|
||||||
module.exports = (env, { mode, watch }) => ({
|
module.exports = (env, { mode }) => ({
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".js", ".css"],
|
extensions: [".js", ".css"],
|
||||||
modules: ["assets", "node_modules"],
|
modules: ["assets", "node_modules"],
|
||||||
@ -23,7 +21,6 @@ module.exports = (env, { mode, watch }) => ({
|
|||||||
path: join("static/assets"),
|
path: join("static/assets"),
|
||||||
publicPath: "",
|
publicPath: "",
|
||||||
},
|
},
|
||||||
watch,
|
|
||||||
performance: {
|
performance: {
|
||||||
hints: false,
|
hints: false,
|
||||||
},
|
},
|
||||||
@ -40,25 +37,12 @@ module.exports = (env, { mode, watch }) => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|jpg|svg)$/,
|
test: /\.(png|jpg|woff|woff2|ttf|eot|svg)$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: "file-loader",
|
loader: "url-loader",
|
||||||
options: {
|
options: {
|
||||||
name: "[name].[ext]",
|
limit: 8192,
|
||||||
outputPath: "images",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|ttf|eot)$/,
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: "file-loader",
|
|
||||||
options: {
|
|
||||||
name: "[name].[ext]",
|
|
||||||
outputPath: "fonts",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -77,14 +61,7 @@ module.exports = (env, { mode, watch }) => ({
|
|||||||
importLoaders: 1,
|
importLoaders: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
"postcss-loader",
|
||||||
loader: "postcss-loader",
|
|
||||||
options: {
|
|
||||||
config: {
|
|
||||||
path: "postcss.config.js",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -94,21 +71,18 @@ module.exports = (env, { mode, watch }) => ({
|
|||||||
name: "vendor",
|
name: "vendor",
|
||||||
minChunks: 2,
|
minChunks: 2,
|
||||||
},
|
},
|
||||||
|
minimize: true,
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new UglifyJsPlugin({
|
new TerserPlugin({
|
||||||
sourceMap: true,
|
parallel: true,
|
||||||
|
extractComments: false,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CleanWebpackPlugin({
|
new CleanWebpackPlugin({
|
||||||
cleanOnceBeforeBuildPatterns: [join("static/assets")],
|
cleanOnceBeforeBuildPatterns: [join("static/assets")],
|
||||||
cleanAfterEveryBuildPatterns: [
|
cleanAfterEveryBuildPatterns: ["!images/**/*", "!fonts/**/*", join("static/assets/style.js")],
|
||||||
"!images/**/*",
|
|
||||||
"!fonts/**/*",
|
|
||||||
// Remove unused file for a production build.
|
|
||||||
mode === "production" && join("static/assets/style.js"),
|
|
||||||
],
|
|
||||||
verbose: true,
|
verbose: true,
|
||||||
}),
|
}),
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
|
Loading…
Reference in New Issue
Block a user