webpack-manifest-resource-plugin
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -67,3 +67,3 @@ var path = require('path'); | ||
ManifestPlugin.prototype.getDeps = function(manifest, commonsChunk) { | ||
ManifestPlugin.prototype.getDeps = function(compiler, manifest, commonsChunk) { | ||
const deps = {}; | ||
@@ -80,13 +80,15 @@ const commonChunkScript = []; | ||
}); | ||
Object.keys(manifest).forEach(pageKey => { | ||
if (/\.js$/.test(pageKey)) { | ||
const dllScript = []; | ||
const dllCss = []; | ||
const pageName = pageKey.replace(/\.js$/, ''); | ||
const isCommonsChunk = commonsChunk.find(chunk => { | ||
return chunk === pageName || typeof chunk === 'object' && chunk.name === pageName; | ||
}); | ||
const webpackConfig = compiler.options; | ||
const entryNames = Object.keys(webpackConfig.entry); | ||
entryNames.forEach(entryName => { | ||
const dllScript = []; | ||
const dllCss = []; | ||
const pageName = entryName.replace(/\.js$/, ''); | ||
const isCommonsChunk = commonsChunk.find(chunk => { | ||
return chunk === pageName || typeof chunk === 'object' && chunk.name === pageName; | ||
}); | ||
if(!isCommonsChunk) { | ||
commonsChunk.forEach(dll => { | ||
if (typeof dll === 'object') { | ||
if (!isCommonsChunk && this.isMatch(dll.include, pageName, true) && !this.isMatch(dll.exclude, pageName, false)) { | ||
if (this.isMatch(dll.include, pageName, true) && !this.isMatch(dll.exclude, pageName, false)) { | ||
const jsKey = `${dll.name}.js`; | ||
@@ -99,5 +101,5 @@ const cssKey = `${dll.name}.css`; | ||
}); | ||
const js = dllScript.concat(commonChunkScript).concat(manifest[pageKey]); | ||
const css = dllCss.concat(commonChunkCss).concat(manifest[pageKey.replace(/\.js$/, '.css')] || []); | ||
deps[pageKey] = { js, css }; | ||
const js = dllScript.concat(commonChunkScript).concat(manifest[`${pageName}.js`] || []); | ||
const css = dllCss.concat(commonChunkCss).concat(manifest[`${pageName}.css`] || []); | ||
deps[entryName] = { js, css }; | ||
} | ||
@@ -108,3 +110,3 @@ }); | ||
ManifestPlugin.prototype.getResource = function(manifest, publicPath) { | ||
ManifestPlugin.prototype.getResource = function(compiler, manifest, publicPath) { | ||
const buildPath = this.opts.buildPath.replace(this.opts.baseDir, '').replace(/^\//, ''); | ||
@@ -149,3 +151,3 @@ const normalizeManifest = this.normalize(manifest); | ||
publicPath = this.opts.proxy ? publicPath.replace(this.opts.host, '') : publicPath; | ||
const depsManifest = this.getDeps(normalizeManifest, commonsChunk); | ||
const depsManifest = this.getDeps(compiler, normalizeManifest, commonsChunk); | ||
return Object.assign({}, normalizeManifest, { | ||
@@ -279,3 +281,3 @@ deps: depsManifest, | ||
var resource = this.getResource(manifest, publicPath); | ||
var resource = this.getResource(compiler, manifest, publicPath); | ||
var json = JSON.stringify(resource, null, 2); | ||
@@ -282,0 +284,0 @@ var outputFolder = compilation.options.output.path; |
{ | ||
"name": "webpack-manifest-resource-plugin", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "webpack manifest resource dependencies plugin", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14507
297