google-fonts-webpack-plugin
google-fonts-webpack-plugin copied to clipboard
Webpack 4 and html-webpack-plugin 4 alpha
So webpack 4 is out and there is an alpha version of the html-webpack-plugin webpack-contrib/html-webpack-plugin
ERROR in TypeError: cb is not a function
- index.js:116 compilation.plugin
[sierranevada-src]/[google-fonts-webpack-plugin]/src/index.js:116:5
- new Promise
- index.js:679
[sierranevada-src]/[html-webpack-plugin]/index.js:679:45
- index.js:141
[sierranevada-src]/[html-webpack-plugin]/index.js:141:16
- util.js:16 tryCatcher
[sierranevada-src]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[sierranevada-src]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[sierranevada-src]/[bluebird]/js/release/promise.js:569:18
- promise.js:614 Promise._settlePromise0
[sierranevada-src]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[sierranevada-src]/[bluebird]/js/release/promise.js:693:18
- async.js:133 Async._drainQueue
[sierranevada-src]/[bluebird]/js/release/async.js:133:16
- async.js:143 Async._drainQueues
[sierranevada-src]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues [as _onImmediate]
[sierranevada-src]/[bluebird]/js/release/async.js:17:14
Apparently webpack4 has overhauled its plugin system Any plan on patching this?
I believe I get a different error for the same reason:
drumstix@Communist-box:~/MEGA/Programming/Electron/freeman$ ./node_modules/.bin/webpack --config webpack.common.js
/home/drumstix/MEGA/Programming/Electron/freeman/node_modules/webpack/node_modules/tapable/lib/Tapable.js:63
throw new Error(`Plugin could not be registered at '${name}'. Hook was not found.\n` +
^
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'.
at Compilation.plugin (/home/drumstix/MEGA/Programming/Electron/freeman/node_modules/webpack/node_modules/tapable/lib/Tapable.js:63:9)
at Compilation.deprecated [as plugin] (internal/util.js:52:15)
at compiler.plugin (/home/drumstix/MEGA/Programming/Electron/freeman/node_modules/google-fonts-webpack-plugin/src/index.js:108:16)
at AsyncParallelHook.eval [as callAsync] (eval at create (/home/drumstix/MEGA/Programming/Electron/freeman/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:13:1)
at AsyncParallelHook.lazyCompileHook [as _callAsync]
... [redacted for brevity's sake]
Looking at the stack trace, looks like Webpack now has a problem with this plugin.
Any response to this? When I migrate to webpack v4, if this is still holding the process back, I'll simply find other ways to get the fonts I'm using in my application. That would be a shame, given I like the value this plugin provides.
@matthew-matvei are you using postcss
in your project? postcss-font-magician
boasts some wild features. Not sure if it's Webpack 4 compatible, but I noticed that one today while researching a bit.
@navelpluisje thanks, #22 solves this!
I'm assuming this project has been abandoned, so I've forked, merged this PR and published the module as @beyonk/google-fonts-webpack-plugin - also on github.
Please test and let me know your findings!