From 34da2e9b9f5001f4b2b0477cc1f6258294d6255e Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Wed, 26 Jul 2023 12:02:01 +0000 Subject: [PATCH] feat: drop support for webpack 4 BREAKING CHANGE: Only webpack 5 is supported. --- .github/workflows/build.yml | 8 -------- README.md | 3 ++- package.json | 2 +- src/plugins/CachePluginFactory.js | 10 +--------- .../Gruntfile.js | 0 .../entry.js | 0 .../{banner-plugin-webpack-4 => banner-plugin}/exec.js | 0 7 files changed, 4 insertions(+), 19 deletions(-) rename tests/integration/fixtures/webpack/{banner-plugin-webpack-4 => banner-plugin}/Gruntfile.js (100%) rename tests/integration/fixtures/webpack/{banner-plugin-webpack-4 => banner-plugin}/entry.js (100%) rename tests/integration/fixtures/webpack/{banner-plugin-webpack-4 => banner-plugin}/exec.js (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4cc6d7..afbfa90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,10 +17,6 @@ jobs: strategy: matrix: node-version: [12.x, 14.x, 16.x, 18.x] - webpack-version: [default, ^4.0.0] - exclude: - - node-version: 18.x - webpack-version: ^4.0.0 steps: - name: Checkout @@ -42,10 +38,6 @@ jobs: if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }} run: yarn install --frozen-lockfile --non-interactive - - name: Install webpack - if: ${{ matrix.webpack-version != 'default' }} - run: yarn add --dev webpack@${{ matrix.webpack-version }} - - name: Unit tests run: yarn test --ci diff --git a/README.md b/README.md index a78e316..3e0be6d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@

Requirements

-- Version 5 of `grunt-webpack` supports webpack version 4 and 5 and (optional) `webpack-dev-server` version 4. +- Version 6 of `grunt-webpack` supports webpack 5 and (optional) `webpack-dev-server` version 4. +- For webpack 4 use version 5 of `grunt-webpack`

Install

diff --git a/package.json b/package.json index 3af4845..13bcb2a 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "tasks" ], "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" + "webpack": "^5.0.0" }, "license": "MIT", "keywords": [ diff --git a/src/plugins/CachePluginFactory.js b/src/plugins/CachePluginFactory.js index dc684cf..1705ab5 100644 --- a/src/plugins/CachePluginFactory.js +++ b/src/plugins/CachePluginFactory.js @@ -1,14 +1,6 @@ "use strict"; -let CachePlugin; -try { - // webpack 5 - CachePlugin = require("webpack/lib/cache/MemoryCachePlugin"); -} catch (e) { - // webpack 4 - // eslint-disable-next-line import/no-unresolved,import/extensions - CachePlugin = require("webpack/lib/CachePlugin"); -} +const CachePlugin = require("webpack/lib/cache/MemoryCachePlugin"); class CachePluginFactory { constructor() { diff --git a/tests/integration/fixtures/webpack/banner-plugin-webpack-4/Gruntfile.js b/tests/integration/fixtures/webpack/banner-plugin/Gruntfile.js similarity index 100% rename from tests/integration/fixtures/webpack/banner-plugin-webpack-4/Gruntfile.js rename to tests/integration/fixtures/webpack/banner-plugin/Gruntfile.js diff --git a/tests/integration/fixtures/webpack/banner-plugin-webpack-4/entry.js b/tests/integration/fixtures/webpack/banner-plugin/entry.js similarity index 100% rename from tests/integration/fixtures/webpack/banner-plugin-webpack-4/entry.js rename to tests/integration/fixtures/webpack/banner-plugin/entry.js diff --git a/tests/integration/fixtures/webpack/banner-plugin-webpack-4/exec.js b/tests/integration/fixtures/webpack/banner-plugin/exec.js similarity index 100% rename from tests/integration/fixtures/webpack/banner-plugin-webpack-4/exec.js rename to tests/integration/fixtures/webpack/banner-plugin/exec.js