google-fonts-webpack-plugin
google-fonts-webpack-plugin copied to clipboard
[email protected] not working with [email protected]
When I try to use [email protected]
with [email protected]
and [email protected]
I am getting the following errors and the code won't compile:
(node:73383) DeprecationWarning: Tapable.plugin is deprecated. Use new API on
.hooks instead
ERROR in TypeError: cb is not a function
- index.js:116 compilation.plugin
[site]/[google-fonts-webpack-plugin]/src/index.js:116:5
- Hook.js:35 AsyncSeriesWaterfallHook.lazyCompileHook [as _promise]
[site]/[tapable]/lib/Hook.js:35:21
- index.js:647
[site]/[html-webpack-plugin]/index.js:647:47
- index.js:162 Promise.resolve.then.then.then.then.compilationResult
[site]/[html-webpack-plugin]/index.js:162:36
Here is the set up in webpack.config
:
var GoogleFontsPlugin = require('google-fonts-webpack-plugin');
new GoogleFontsPlugin({
fonts: [{
family: 'Open Sans',
variants: ['400']
},
{
family: 'Ubuntu',
variants: ['500', '400', '300']
}]
})
I have used similar code in webpack v3 and was easily able to use Google fonts.
I have the same issue. anyone can update this?
@dashawk
I've imported the Google fonts into my css file like this:
@import url("https://fonts.googleapis.com/css?family=Ubuntu:500,400,300");
@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600");
That is working fine on dev and production.
I am having the same issue. Doesn't seem to be compatible with webpack 4. I am new to webpack or else I'd fix this right now. I think it's pretty awesome to just let webpack handle google fonts.
Error: Plugin could not be registered at 'html-webpack-plugin-before-html-generation'. Hook was not found.
BREAKING CHANGE: There need to exist a hook at 'this.hooks'. To create a compatiblity layer for this hook, hook into 'this._pluginCompat'.
The plugin needs to update html-webpack-plugin, webpack 4 changed the way plugins communicate.
It seems that #22 fixes the callback issue but still has to be merged (still the deprecation warning for the Tapable.plugin is present but the plugin works with Webpack 4 if @navelpluisje branch is used).
@gabiseabra Can you merge the fixes for webpack4?
+1
I'm running webpack at 4.20.0 and I'm trying to use this plugin at version 0.4.4.
I'm getting the same error as @ameshkin , which renders this plugin unusable in the future.
This package has solved this for me https://github.com/beyonk-adventures/google-fonts-webpack-plugin , its compatible with Webpack 4.