@caweb/html-webpack-plugin 2.1.6 → 2.1.8

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ v2.1.8
2
+ - Added check before files are emitted, this prevents error where multiple files emit the same filename
3
+
4
+ v2.1.7
5
+ - Updated npm packages
6
+
1
7
  v2.1.6
2
8
  - Fixed issue with the way additional assets were being emitted
3
9
  - Updated npm packages
package/index.js CHANGED
@@ -199,14 +199,19 @@ class CAWebHTMLPlugin extends HtmlWebpackPlugin{
199
199
  allAssets.forEach( asset =>{
200
200
  // we add the asset to the compilation file dependencies so webpack watches it for changes
201
201
  // compilation.fileDependencies.add( path.join( appPath, asset ) );
202
-
202
+ let fn = asset.replace(appPath, '').replace(/[\\\/]?node_modules[\\\/@]+/g, '')
203
+
204
+ // if the asset hasn't already been emitted, we emit this prevents the error where multiple assets emit to the same filename
205
+ if( ! compilation.getAssets().map( (asset) => asset.name).includes( fn ) ){
203
206
  compilation.emitAsset(
204
207
  // we remove the appPath from the asset path
205
208
  // we remove the node_modules/@ from the asset path
206
209
  asset.replace(appPath, '').replace(/[\\\/]?node_modules[\\\/@]+/g, ''),
207
210
  new compiler.webpack.sources.RawSource( fs.readFileSync(path.join( appPath, asset ) ) )
208
211
  );
209
-
212
+
213
+ }
214
+
210
215
  });
211
216
 
212
217
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "CAWebPublishing Site Generation HTML Webpack Plugin",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,9 +25,9 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@caweb/framework": "^1.9.9",
28
+ "@caweb/framework": "^1.9.10",
29
29
  "@caweb/icon-library": "^1.1.7",
30
- "@caweb/template": "^1.0.16",
30
+ "@caweb/template": "^1.0.18",
31
31
  "html-webpack-plugin": "^5.6.6"
32
32
  },
33
33
  "scripts": {