static-render-webpack-plugin
static-render-webpack-plugin copied to clipboard
Ability to use chunkname instead of bundle
trafficstars
This would make content hash caching easier. For example ExtractTextPlugin allows this:
new ExtractTextPlugin('[name]-[contenthash].css')
It would be nice if we could do this:
...snip
new StaticSiteGeneratorPlugin('app-[contenthash].js', routes)
...snip
var entry = {
app: './app',
hot = [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./app',
]
}
...snip
output: {
filename: '[name]-[contenthash].js',
path: path.join(__dirname, 'dist'),
// This is really important, the plugin expects the bundle output to export a function!
libraryTarget: 'umd',
},
And then some way to get paths to these assets into the props of the app... I tried to hack something together like this:
var assets = compiler.getStats().toJson().assetsByChunkName[self.bundlePath];
var sourceAsset = compiler.assets[assets && assets[0]];
But I don't really know what I am doing :P And haven't managed to get the paths into the app to load them yet.
Webpack's compiler is hideously undocumented, so please let me know if you make developments on that front. Good point about this though.
+1