Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected] not working with [email protected] #24

Open
swichelecki opened this issue Apr 14, 2018 · 9 comments
Open

[email protected] not working with [email protected] #24

swichelecki opened this issue Apr 14, 2018 · 9 comments

Comments

@swichelecki
Copy link

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.

@dashawk
Copy link

dashawk commented May 9, 2018

I have the same issue. anyone can update this?

@swichelecki
Copy link
Author

swichelecki commented May 9, 2018

@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.

@ameshkin
Copy link

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'.


@nukeop
Copy link

nukeop commented Jun 2, 2018

The plugin needs to update html-webpack-plugin, webpack 4 changed the way plugins communicate.

@gcalmettes
Copy link

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).

@camflan
Copy link

camflan commented Jul 26, 2018

@gabiseabra Can you merge the fixes for webpack4?

@ghost
Copy link

ghost commented Aug 13, 2018

+1

@fridde
Copy link

fridde commented Jan 13, 2019

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.

@Safiyya
Copy link

Safiyya commented Jan 30, 2019

This package has solved this for me https://github.com/beyonk-adventures/google-fonts-webpack-plugin , its compatible with Webpack 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants