GoogleChromeLabs / preload-webpack-plugin

Please use https://github.com/vuejs/preload-webpack-plugin instead.
Apache License 2.0
2.16k stars 144 forks source link

Plugin could not be registered at 'html-webpack-plugin-before-html-processing'. Hook was not found. #86

Open wind4gis opened 5 years ago

wind4gis commented 5 years ago

I'm using CRA which using "html-webpack-plugin": "4.0.0-alpha.2" When I write it on my package.json snipaste_2018-12-26_16-11-20 However, it shows error snipaste_2018-12-26_16-12-57

is the plugin don't support webpack4???

phetw commented 5 years ago

the current version of this package does not work with html-webpack-plugin v4 Please refer this issue

or

you can try yarn add preload-webpack-plugin@3.0.0-beta.3

Tim-ls commented 5 years ago

I have same error.

guirip commented 5 years ago

Same error for me when using

"preload-webpack-plugin": "^2.3.0"

. If I add v3.0.0-beta.1 (which is the most recent release indicated here), then I get an error about missing module @babel/runtime/core-js/get-iterator despite I have the dependency "@babel/runtime": "^7.2.0" .

Finally what worked is:

npm install --save-dev preload-webpack-plugin@3.0.0-beta.3

Thanks @rappad for the issue link above.

indusoni commented 5 years ago

@guirip Yes with preload-webpack-plugin@3.0.0-beta.3 ,its building successfully,but its not adding perload/prefetch . config for this is like below mentioned new PreloadWebpackPlugin({ rel: 'preload', include:['main','vendor'] }),

Webpack version : 4.28.3

leifj commented 4 years ago

fwiw 3.0.0-beta.3 worked for me and generated links

eugenmihailescu commented 4 years ago

Yes, 3.0.0-beta.3 worked for me too

iampava commented 4 years ago

Interesting... It didn't work for me so I found a workaround using HTMLWebpackPlugin:

<link rel="preload" href="<%= compilation.getAssets().find(asset => /Roboto[.].+[.]woff2/.exec(asset.name)).name %>" as="font" type="font/woff2" crossorigin>
tmladek commented 4 years ago

Confirming, same error, specifying 3.0.0-beta.3 fixed the issue.

Looking forward to when it's not a beta! (: