From 7fd161436c09b589e881abf222e4ca43afee0712 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 30 Nov 2020 11:50:25 -0500 Subject: [PATCH 1/3] Added `nodemon` so `webpack-dev-server` will automatically restart if we change any of the webpack configs --- buildchain/nodemon.json | 8 ++++++++ buildchain/package.json | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 buildchain/nodemon.json diff --git a/buildchain/nodemon.json b/buildchain/nodemon.json new file mode 100644 index 0000000..749d225 --- /dev/null +++ b/buildchain/nodemon.json @@ -0,0 +1,8 @@ +{ + "watch": [ + "webpack.dev.js", + "webpack-configs/*.js", + "webpack-settings/*.js" + ], + "exec": "webpack serve --config webpack.dev.js" +} diff --git a/buildchain/package.json b/buildchain/package.json index 51134c7..eb166ba 100644 --- a/buildchain/package.json +++ b/buildchain/package.json @@ -89,6 +89,7 @@ "imagemin-webp-webpack-plugin": "^3.3.0", "img-loader": "^3.0.0", "mini-css-extract-plugin": "^1.2.0", + "nodemon": "^2.0.6", "postcss": "^8.1.1", "postcss-import": "^12.0.0", "postcss-loader": "^4.1.0", @@ -107,7 +108,7 @@ "webpack": "^5.3.0", "webpack-bundle-analyzer": "^4.0.0-rc1", "webpack-cli": "^4.1.0", - "webpack-dev-server": "^3.3.0", + "webpack-dev-server": "^v4.0.0-beta.0", "webpack-manifest-plugin": "^3.0.0-rc.0", "webpack-merge": "^5.3.0", "workbox-webpack-plugin": "^6.0.0-alpha.3" @@ -127,8 +128,8 @@ "scripts": { "build": "webpack --config webpack.prod.js --progress", "check-types": "tsc", - "debug": "webpack serve --config webpack.dev.js", - "dev": "webpack serve --config webpack.dev.js", + "debug": "nodemon", + "dev": "nodemon", "lint": "tsc --noEmit && eslint '../../src/**/*.{js,ts,vue}' --fix" }, "version": "1.1.3" From cae32f31444265c24d9969fac23b3fe52dd70d81 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 30 Nov 2020 11:51:14 -0500 Subject: [PATCH 2/3] Use `webpack-dev-server` version `^4.0.0-beta.0` for additional speed & better webpack 5 support --- buildchain/webpack-configs/app.config.js | 3 +++ .../webpack-configs/dev-server.config.js | 22 ++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/buildchain/webpack-configs/app.config.js b/buildchain/webpack-configs/app.config.js index cadd636..d3aa4a4 100644 --- a/buildchain/webpack-configs/app.config.js +++ b/buildchain/webpack-configs/app.config.js @@ -27,6 +27,9 @@ module.exports = (type = 'modern', settings) => { path.resolve(__dirname, '../node_modules'), ], }, + stats: { + colors: true, + }, }); // configs const configs = { diff --git a/buildchain/webpack-configs/dev-server.config.js b/buildchain/webpack-configs/dev-server.config.js index c3673ec..fabb169 100644 --- a/buildchain/webpack-configs/dev-server.config.js +++ b/buildchain/webpack-configs/dev-server.config.js @@ -12,8 +12,13 @@ module.exports = (type = 'modern', settings) => { // common config const common = () => ({ devServer: { - contentBase: path.resolve(__dirname, settings.contentBase()), - disableHostCheck: true, + client: { + progress: false, + }, + dev: { + publicPath: '/', + }, + firewall: false, headers: { 'Access-Control-Allow-Origin': '*' }, @@ -23,11 +28,13 @@ module.exports = (type = 'modern', settings) => { overlay: true, port: settings.port(), public: settings.public(), - publicPath: '/', - watchContentBase: true, - watchOptions: { - poll: !!parseInt(settings.poll()), - ignored: /node_modules/, + static: { + directory: path.resolve(__dirname, settings.contentBase()), + publicPath: '/', + watch: { + poll: !!parseInt(settings.poll()), + ignored: /node_modules/, + }, }, }, devtool: false, @@ -48,7 +55,6 @@ module.exports = (type = 'modern', settings) => { exclude: /\.(pcss|css)($|\?)/i, }), ], - target: 'web', }); // configs const configs = { From 6f47d76110b2dd965a9b5e42155b9795932a9cbb Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 30 Nov 2020 11:51:23 -0500 Subject: [PATCH 3/3] Version 2.4.8 --- CHANGELOG.md | 7 +++++++ composer.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 878b6cb..470fb67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # nystudio107/craft Change Log +## 2.4.8 - 2020.11.30 +### Added +* Added `nodemon` so `webpack-dev-server` will automatically restart if we change any of the webpack configs + +### Changed +* Use `webpack-dev-server` version `^4.0.0-beta.0` for additional speed & better webpack 5 support + ## 2.4.7 - 2020.11.26 ### Changed * Remove `postcss-preset-env`, add `autoprefixer` & `postcss-nested` diff --git a/composer.json b/composer.json index d609864..54a216b 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "craftcms/craft", "description": "nystudio107 Craft 3.4 CMS scaffolding project", - "version": "2.4.7", + "version": "2.4.8", "keywords": [ "craft", "cms",