Is it possible to use html-webpack-plugin to write some chunks in head and some in body?
This is my config for html-webpack-plugin:
var HtmlWebpackPluginConfigIndex = {
template: path.join(__dirname, 'src/core/server/views', 'index.dust'),
filename: 'core/server/views/index.dust',
hash: true,
chunksSortMode: 'none'
// chunks: ['core/public/js/vendor']
};
When I use copy with this config but with changed chunks:
var HtmlWebpackPluginConfigIndex = {
template: path.join(__dirname, 'src/core/server/views', 'index.dust'),
filename: 'core/server/views/index.dust',
hash: true,
inject: 'head',
chunksSortMode: 'none'
chunks: ['core/public/js/vendor']
};
var HtmlWebpackPluginConfigIndex2 = {
template: path.join(__dirname, 'src/core/server/views', 'index.dust'),
filename: 'core/server/views/index.dust',
hash: true,
inject: 'body',
chunksSortMode: 'none'
chunks: ['core/public/js/app']
};
....
new HtmlWebpackPlugin(HtmlWebpackPluginConfigIndex);
new HtmlWebpackPlugin(HtmlWebpackPluginConfigIndex2);
Webpack apply only last of chunks for html-webpack-plugin.
you could try forking the project, then fiddle the code something like this:
html-webpack-plugin index.js:
and then add a
headScripts
option to your plugin definition: