preload-webpack-plugin
preload-webpack-plugin copied to clipboard
ERROR in TypeError: cb is not a function
preload-webpack-plugin": "^3.0.0-alpha.3
webpack": "^4.16.
DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks
instead
ERROR in TypeError: cb is not a function
I got the same error, upgrading to 3.0.0-beta.1
resolved this. Hope it helps.
Unable to tap into the HtmlWebpackPlugin's callbacks. Make sure to list PreloadPlugin at some point after HtmlWebpackPlugin in webpack's plugins array.
Is this the next error you get? If so you need to define PreloadWebpackPlugin
after HtmlWebpackPlugin
, as explained in the docs.
plugins: [
new HtmlWebpackPlugin(),
new PreloadWebpackPlugin()
]
There's nothing wrong with that,but it doesn't work
got the same error, upgrading to 3.0.0-beta.2
Can you post your Webpack config and the versions of related dependencies?
I'm also getting this error @timothyvanderaerden @awesomepeng.

@tr1s It's very hard to find a solution with little information. If you, or any one else with this issue, can post the webpack configuration and package.json file, I'm sure this issue can be resolved.
I'm also getting this error @timothyvanderaerden @awesomepeng.
![]()
show your code
@timothyvanderaerden @awesomepeng I have a fully functioning webpack-boilerplate repo that I'm trying to add the preloading to. Please head over there and look at the config and/or git clone and npm install
and then npm run start
to get it going.
My boilerplate is working right now, but once I npm install preload-webpack-plugin
, add const PreloadWebpackPlugin = require('preload-webpack-plugin');
and new PreloadWebpackPlugin()
to the webpack.common.js config I get the error I posted above, and my webpage produces this image below.

I have tried updating all my npm packages as well as trying different options for the PreloadWebpackPlugin()
but I still get the same errors.
Please let me know if you know what's wrong with all this information now, thank you.
@tr1s I looked at your project and got it working just fine. You are using Webpack 4 but, as far as I know, the current version of preload-webpack-plugin doesn't support it yet. You should use version 3.0.0-beta.
You can install it like this: npm install [email protected] --save-dev
@timothyvanderaerden thanks. The comment was so old I assumed it was out of beta by now.
same, it is not working
Same, is not working