preload-webpack-plugin
preload-webpack-plugin copied to clipboard
preload not worked as expected
I'm using the beta, so that fixed my cb is not a function problem, but now nothing will append.
I've tried putting it after the HtmlWebpackPlugin and after the ScriptExtHtmlWebpackPlugin plugins and neither worked. I also tried
plugins: [
new HtmlWebpackPlugin(),
new PreloadWebpackPlugin({
rel: 'preload',
as(entry) {
if (/\.css$/.test(entry)) return 'style';
if (/\.woff$/.test(entry)) return 'font';
if (/\.png$/.test(entry)) return 'image';
return 'script';
}
})
]
as well as...
plugins: [
new HtmlWebpackPlugin(),
new PreloadWebpackPlugin()
]
but nothing seems to work.
@timothyvanderaerden you helped me before with the beta issue. Is there any chance you can test my webpack-boilerplate and see if it's working for you? or perhaps see what I'm doing wrong?
Thank you, let me know. I'd like to get this working for my CSS file and woff2/woff links that are being injected.
This is more of a question then a bug which is discussed here: #55. I opened a pull request in your project with the suggested changes.
For reference to anyone landing on this thread, if you want to use preload for something that is resolved using file-loader. You should include allAssets.
new PreloadWebpackPlugin({
rel: 'preload',
include: 'allAssets'
}),