@caweb/webpack 1.3.31 → 1.3.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "CAWebPublishing Sample Page and Configurations",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -105,27 +105,29 @@
105
105
  },
106
106
  "homepage": "https://github.com/CAWebPublishing/webpack/plugins/html#readme",
107
107
  "devDependencies": {
108
- "@inquirer/prompts": "^7.4.0",
108
+ "@caweb/icon-library": "^1.0.1",
109
+ "@inquirer/prompts": "^7.4.1",
109
110
  "animate.css": "^4.1.1",
110
- "bootstrap": "^5.3.3",
111
+ "bootstrap": "^5.3.4",
111
112
  "bootstrap-forced-colors-css": "^1.0.7",
112
113
  "chalk": "^5.4.1",
113
114
  "cross-spawn": "^7.0.6",
114
- "fast-xml-parser": "^5.0.9",
115
- "mini-css-extract-plugin": "^2.9.2"
115
+ "fast-xml-parser": "^5.2.0"
116
116
  },
117
117
  "dependencies": {
118
118
  "@caweb/a11y-webpack-plugin": "^1.0.9",
119
119
  "@caweb/css-audit-webpack-plugin": "^1.0.12",
120
120
  "@caweb/jshint-webpack-plugin": "^2.0.1",
121
- "@wordpress/scripts": "^30.13.0",
121
+ "@wordpress/scripts": "^30.14.1",
122
122
  "css-minimizer-webpack-plugin": "^7.0.2",
123
123
  "handlebars-loader": "^1.7.3",
124
124
  "html-webpack-link-type-plugin": "^1.1.1",
125
125
  "html-webpack-plugin": "^5.6.3",
126
126
  "html-webpack-skip-assets-plugin": "^1.0.4",
127
+ "mini-css-extract-plugin": "^2.9.2",
127
128
  "rtlcss-webpack-plugin": "^4.0.7",
128
129
  "webpack": "^5.98.0",
129
- "webpack-cli": "^6.0.1"
130
+ "webpack-cli": "^6.0.1",
131
+ "webpack-remove-empty-scripts": "^1.0.4"
130
132
  }
131
- }
133
+ }
@@ -39,6 +39,7 @@ const currentPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '
39
39
  export default {
40
40
  entry: {
41
41
  ${scheme}: [
42
+ path.join(currentPath, 'node_modules/@caweb/icon-library/build/font-only.css'),
42
43
  path.join(currentPath, ${correctFiles.join('),\n' + `\t`.repeat(3) + 'path.join(currentPath, ')})
43
44
  ]
44
45
  }
@@ -20,6 +20,7 @@ import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
20
20
  import RtlCssPlugin from 'rtlcss-webpack-plugin';
21
21
  import {HtmlWebpackSkipAssetsPlugin} from 'html-webpack-skip-assets-plugin';
22
22
  import {HtmlWebpackLinkTypePlugin} from 'html-webpack-link-type-plugin';
23
+ import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
23
24
 
24
25
  import JSHintPlugin from '@caweb/jshint-webpack-plugin';
25
26
  import CSSAuditPlugin from '@caweb/css-audit-webpack-plugin';
@@ -110,19 +111,33 @@ let webpackConfig = {
110
111
  mode,
111
112
  name: 'uncompressed',
112
113
  target: 'web',
114
+ // Turn off caching of generated modules and chunks.
115
+ // @see https://webpack.js.org/configuration/cache/
113
116
  cache: false,
117
+
114
118
  stats: 'errors',
119
+
120
+ // Determine where the created bundles will be outputted.
121
+ // @see https://webpack.js.org/concepts/#output
115
122
  output: {
116
123
  ...baseConfig.output,
117
124
  clean: mode === 'production',
118
125
  pathinfo: false
119
126
  },
127
+
120
128
  performance: {
121
129
  maxAssetSize: 500000,
122
130
  maxEntrypointSize: 500000
123
131
  },
132
+
133
+ // This option determine how different types of module within the project will be treated.
134
+ // @see https://webpack.js.org/configuration/module/
124
135
  module:{
125
136
  ...baseConfig.module,
137
+ // This option sets up loaders for webpack configuration.
138
+ // Loaders allow webpack to process various types because by default webpack only
139
+ // understand JavaScript and JSON files.
140
+ // @see https://webpack.js.org/concepts/#loaders
126
141
  rules: [
127
142
  ...baseConfig.module.rules,
128
143
  /**
@@ -176,6 +191,23 @@ let webpackConfig = {
176
191
  }
177
192
  ]
178
193
  },
194
+ // WordPress already enqueues scripts and makes them available
195
+ // in global scope so those scripts don't need to be included on the bundle. For webpack
196
+ // to recognize those files, the global variable needs to be registered as externals.
197
+ // These allows global variable listed below to be imported into the module.
198
+ // @see https://webpack.js.org/configuration/externals/#externals
199
+ externals: {
200
+ // Third party dependencies.
201
+ jquery: 'jQuery',
202
+ underscore: '_',
203
+ lodash: 'lodash',
204
+ react: ['vendor', 'React'],
205
+ 'react-dom': ['vendor', 'ReactDOM'],
206
+
207
+ // WordPress dependencies.
208
+ '@wordpress/hooks': ['vendor', 'wp', 'hooks'],
209
+
210
+ },
179
211
  };
180
212
 
181
213
  /**
@@ -325,4 +357,8 @@ if( mode === 'production' ){
325
357
  )
326
358
  }
327
359
 
360
+ // we remove empty scripts
361
+ webpackConfig.plugins.push(
362
+ new RemoveEmptyScriptsPlugin()
363
+ );
328
364
  export default webpackConfig;