Closed pldg closed 6 years ago
I ran into this issue as well - @pldg 's solution worked with one alteration to support Webpack's publicPath
config.
<% if (webpackManifestName) { %>
<script type="text/javascript">
<% const webpackManifest = htmlWebpackPlugin.files.js
.filter( file => file.match(webpackManifestName) )[0]
.replace(webpackConfig.output.publicPath, '') %>
<%= compilation.assets[webpackManifest].source() %>
</script>
<% } %>
Would be nice a solution that works without adding InlineManifestWebpackPlugin to delete dist/runtime.js but for now I'm closing this issue.
I try to inline webpack manifest but with the following config is not working:
Note:
'runtime'
is the default name for webpack manifest.My
devDependencies
versions:What's happen
Looking inside
html-webpack-template.ejs
I see:Logging
htmlWebpackPlugin.files
, there is no plain manifest code inside this object but only a reference to'runtime'
chunk.Solution
We can use the
compilation
object and add the following code to the template:webpackManifestName
above<!DOCTYPE html>
inlineManifestWebpackName
logic with a new oneNote:
InlineManifestWebpackPlugin
is not strictly necessary, in this case it's used to delete runtime.js chunk in thedist/
folder.