Browse Source

chore: switch to BannerPlugin + update webpack deps

supersedes the abandoned wrapper-webpack-plugin which started to emit a compilation hook warning
tophf 1 year ago
parent
commit
d7d0f0cd90
3 changed files with 354 additions and 312 deletions
  1. 6 7
      package.json
  2. 12 2
      scripts/webpack-util.js
  3. 336 303
      yarn.lock

+ 6 - 7
package.json

@@ -47,7 +47,7 @@
     "cross-env": "^7.0.3",
     "cross-spawn": "^7.0.3",
     "css-loader": "^6.8.1",
-    "css-minimizer-webpack-plugin": "^5.0.1",
+    "css-minimizer-webpack-plugin": "^7.0.0",
     "del": "^6.1.1",
     "eslint": "^8.57.1",
     "eslint-config-prettier": "^9.0.0",
@@ -57,9 +57,9 @@
     "fancy-log": "^2.0.0",
     "gulp": "^4.0.2",
     "gulp-plumber": "^1.1.0",
-    "html-webpack-plugin": "^5.5.3",
+    "html-webpack-plugin": "^5.6.0",
     "husky": "^8.0.1",
-    "jest": "^29.6.2",
+    "jest": "^29.7.0",
     "jest-environment-jsdom": "^29.7.0",
     "js-yaml": "^4.1.0",
     "lodash": "^4.17.21",
@@ -83,10 +83,9 @@
     "vinyl": "^2.2.1",
     "vue-loader": "^17.4.2",
     "vue-tsc": "^2.0.29",
-    "webpack": "^5.88.2",
-    "webpack-bundle-analyzer": "^4.9.0",
-    "webpack-cli": "^5.1.4",
-    "wrapper-webpack-plugin": "2.2.2"
+    "webpack": "^5.95.0",
+    "webpack-bundle-analyzer": "^4.10.2",
+    "webpack-cli": "^5.1.4"
   },
   "author": "Gerald <[email protected]>",
   "repository": {

+ 12 - 2
scripts/webpack-util.js

@@ -1,6 +1,6 @@
 const fs = require('fs');
 const babelCore = require('@babel/core');
-const WrapperWebpackPlugin = require('wrapper-webpack-plugin');
+const webpack = require('webpack');
 
 const entryGlobals = {
   'common': [],
@@ -65,7 +65,17 @@ function addWrapperWithGlobals(name, config, defsObj, callback) {
     .join('\n')
     .replace(defsRe, s => defsObj[s])
   );
-  config.plugins.push(new WrapperWebpackPlugin(callback(reader)));
+  const { header, footer, test } = callback(reader);
+  const opts = {
+    test,
+    banner: header,
+    entryOnly: true,
+    raw: true,
+  };
+  config.plugins.push(
+    new webpack.BannerPlugin(opts),
+    new webpack.BannerPlugin({ ...opts, banner: footer, footer: true })
+  );
 }
 
 function getCodeMirrorThemes() {

File diff suppressed because it is too large
+ 336 - 303
yarn.lock


Some files were not shown because too many files changed in this diff