To generate an inline JS code in an HTML page:
Index.html
<! DOCTYPE html>
Webpack.config.js
var htmlwebpackplugin=require ("Html-webpack-plugin"); Module.exports={entry:{main: './src/script/main.js ', A: './ Src/script/a.js ', B: "./src/script/b.js", C: "./src/script/c.js"},output:{path:__dirname+ "/dist", FileName: "js/[ Name].js "},plugins:[new htmlwebpackplugin ({Template: ' index.html ', inject: ' Body ', FileName:" a.html ", Title:" This is A.html ", chunks:[' main ', ' A ']}), new Htmlwebpackplugin ({Template:" index.html ", Inject: ' Body ', FileName:" b.html ", Title: "This is b.html", chunks:[' main ', ' A ']}), new Htmlwebpackplugin ({Template: "index.html", Inject: ' Body ', filename: "C.html", Title: "This is c.html", chunks:[' main ', ' C ']})]}
Began spelling the wrong <%= compilation.assets[htmlwebpackplugin.files.chunks.main.entry.substr ( HtmlWebpackPlugin.files.publicPath.length)].source ()%>
</script> Write error: <%= compilation.asseRTS[htmlwebpackplugin.files.chunks.main.entry.substr ( HtmlWebpackPlugin.files.publicPath.length)].source ()%>
</script>
Always error:
Webpack Study Record-02