Skip to content

Commit

Permalink
Merge pull request #91 from WiseBird/master
Browse files Browse the repository at this point in the history
Prevented source maps from being injected into html
  • Loading branch information
asfktz authored Dec 12, 2017
2 parents d2f3ee3 + c4d6238 commit cda780b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,27 @@ class AutoDLLPlugin {
});

if (inject) {
const getDllEntriesPaths = extension =>
flatMap(memory.getStats().entrypoints, 'assets')
.filter(filename => filename.endsWith(extension))
.map(filename =>
getInjectPath({
publicPath: settings.publicPath,
pluginPath: settings.path,
filename,
})
);

compiler.plugin('compilation', compilation => {
compilation.plugin(
'html-webpack-plugin-before-html-generation',
(htmlPluginData, callback) => {
const dllEntriesPaths = flatMap(memory.getStats().entrypoints, 'assets').map(filename =>
getInjectPath({
publicPath: settings.publicPath,
pluginPath: settings.path,
filename,
})
htmlPluginData.assets.js = concat(getDllEntriesPaths('.js'), htmlPluginData.assets.js);
htmlPluginData.assets.css = concat(
getDllEntriesPaths('.css'),
htmlPluginData.assets.css
);

htmlPluginData.assets.js = concat(dllEntriesPaths, htmlPluginData.assets.js);

callback(null, htmlPluginData);
}
);
Expand Down

0 comments on commit cda780b

Please sign in to comment.