Socket
Socket
Sign inDemoInstall

assets-webpack-plugin

Package Overview
Dependencies
3
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.0 to 6.1.1

dist/lib/getDynamicImportedChildAssets.js

4

changelog.md

@@ -8,2 +8,6 @@ # Change Log

## 6.1.1 - 2020-12-03
* Adds the `includeDynamicImportedAssets` option
* Closes [#313](https://github.com/ztoben/assets-webpack-plugin/issues/312)
## 6.1.0 - 2020-12-03

@@ -10,0 +14,0 @@ * Closes [#312](https://github.com/ztoben/assets-webpack-plugin/issues/312)

@@ -14,2 +14,3 @@ 'use strict';

var isSourceMap = require('./lib/isSourceMap');
var getDynamicImportedChildAssets = require('./lib/getDynamicImportedChildAssets');

@@ -31,2 +32,3 @@ var createQueuedWriter = require('./lib/output/createQueuedWriter');

includeAuxiliaryAssets: false,
includeDynamicImportedAssets: false,
keepInMemory: false,

@@ -104,2 +106,7 @@ integrity: false,

if (self.options.includeDynamicImportedAssets && chunkName && stats.entrypoints[chunkName].children) {
var dynamicImportedChildAssets = getDynamicImportedChildAssets(options, stats.entrypoints[chunkName].children);
assets = [].concat(_toConsumableArray(assets), _toConsumableArray(dynamicImportedChildAssets));
}
if (!Array.isArray(assets)) {

@@ -122,2 +129,3 @@ assets = [assets];

var integrity = compilationAsset && compilationAsset.integrity;
var loadingBehaviour = obj.loadingBehaviour;

@@ -134,3 +142,11 @@ if (type === 'undefined') {

}
typeMap[typeName].push(combinedPath);
if (self.options.includeDynamicImportedAssets && loadingBehaviour) {
var typeNameWithLoadingBehaviour = typeName + ':' + loadingBehaviour;
typeMap[typeNameWithLoadingBehaviour] = typeMap[typeNameWithLoadingBehaviour] || [];
typeMap[typeNameWithLoadingBehaviour].push(combinedPath);
} else {
typeMap[typeName].push(combinedPath);
}
}

@@ -137,0 +153,0 @@

@@ -8,2 +8,3 @@ const fs = require('fs')

const isSourceMap = require('./lib/isSourceMap')
const getDynamicImportedChildAssets = require('./lib/getDynamicImportedChildAssets')

@@ -25,2 +26,3 @@ const createQueuedWriter = require('./lib/output/createQueuedWriter')

includeAuxiliaryAssets: false,
includeDynamicImportedAssets: false,
keepInMemory: false,

@@ -102,2 +104,7 @@ integrity: false,

if (self.options.includeDynamicImportedAssets && chunkName && stats.entrypoints[chunkName].children) {
const dynamicImportedChildAssets = getDynamicImportedChildAssets(options, stats.entrypoints[chunkName].children)
assets = [...assets, ...dynamicImportedChildAssets]
}
if (!Array.isArray(assets)) {

@@ -120,2 +127,3 @@ assets = [assets]

const integrity = compilationAsset && compilationAsset.integrity
const loadingBehaviour = obj.loadingBehaviour

@@ -132,3 +140,11 @@ if (type === 'undefined') {

}
typeMap[typeName].push(combinedPath)
if (self.options.includeDynamicImportedAssets && loadingBehaviour) {
const typeNameWithLoadingBehaviour = typeName + ':' + loadingBehaviour
typeMap[typeNameWithLoadingBehaviour] = typeMap[typeNameWithLoadingBehaviour] || []
typeMap[typeNameWithLoadingBehaviour].push(combinedPath)
} else {
typeMap[typeName].push(combinedPath)
}
}

@@ -135,0 +151,0 @@

4

package.json
{
"name": "assets-webpack-plugin",
"version": "6.1.0",
"version": "6.1.1",
"description": "Emits a json file with assets paths",

@@ -42,3 +42,3 @@ "main": "dist/index.js",

"css-loader": "5.0.1",
"mini-css-extract-plugin": "1.3.1",
"mini-css-extract-plugin": "1.3.2",
"mocha": "8.2.1",

@@ -45,0 +45,0 @@ "rimraf": "3.0.2",

@@ -368,2 +368,13 @@ # assets-webpack-plugin

#### `includeDynamicImportedAssets`
Optional. `false` by default.
When set, will output any files that are part of the chunk and marked as preloadable or prefechtable child assets via a dynamic import.
See: https://webpack.js.org/guides/code-splitting/#prefetchingpreloading-modules
```js
new AssetsPlugin({includeDynamicImportedAssets: true})
```
### Using in multi-compiler mode

@@ -370,0 +381,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc