asset-map-webpack-plugin
Advanced tools
Comparing version 0.0.2 to 0.0.3
11
index.js
@@ -13,2 +13,3 @@ var fs = require('fs'); | ||
var requestShortener = new RequestShortener(path.dirname(this.outputFile)); | ||
var emitted = false; | ||
var assets = stats.compilation.modules | ||
@@ -18,7 +19,9 @@ .map(function(m) { | ||
name: m.readableIdentifier(requestShortener), | ||
assets: Object.keys(m.assets || {}) | ||
} | ||
assets: Object.keys(m.assets || {}), | ||
module: m | ||
}; | ||
}).filter(function(m){ | ||
return m.assets.length > 0; | ||
}).reduce(function(acc, m) { | ||
emitted = emitted || m.assets[0].emitted; | ||
acc[m.name] = path.join(this.publicPath, m.assets[0]); | ||
@@ -28,3 +31,5 @@ return acc; | ||
fs.writeFileSync(this.outputFile, JSON.stringify(assets)); | ||
if (emitted) { | ||
fs.writeFileSync(this.outputFile, JSON.stringify(assets)); | ||
} | ||
}.bind(this)); | ||
@@ -31,0 +36,0 @@ }; |
{ | ||
"name": "asset-map-webpack-plugin", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Webpack plugin that creates a map of assets to public url slug for server agnostic usage.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
2539
31