patrickhulce / fontmin-webpack

Minifies icon fonts to just the used glyphs.
MIT License
139 stars 19 forks source link

Not working if used along with extract-text-webpack-plugin #6

Closed milewski closed 7 years ago

milewski commented 7 years ago

weird bug if used along with extract-text-webpack-plugin... i tried to fix.. but no luck..~

example.

new ExtractTextPlugin({
    filename: '[name].css',
    allChunks: true, <-- if set to false then fontmin-webpack will works fine... 
})

files are not being matched... probably extract-text modifies compilation.modules.. don't know ~

patrickhulce commented 7 years ago

Thanks for reporting @Milewski! What behavior do you see instead? The font doesn't get any smaller, build fails, other?

patrickhulce commented 7 years ago

Would you also mind sharing the version of webpack, version of ExtractTextWebpackPlugin, and the full webpack config if it's available publicly? :)

milewski commented 7 years ago

there is no crash... fontmin just receives a empty array [] of files so it doesnt get minified ...

here is a sample of not a working config

https://gist.github.com/Milewski/9aee18e3fe78134618c224789951ed10

this should produce a index.html and by disabling AllChunks it should work normally

(and everything should be the latest version as from today it was just a fresh install)

patrickhulce commented 7 years ago

Hmmm, strange I'm having some trouble reproducing I'll have to dig in later. If you have some time to adjust the my test branch to match your use case and get it to fail I'll be happy to fix it!

milewski commented 7 years ago

I tried to run your tests but they all fail... npm install dont get nukecss and xo,mocha,istanbul... installed.. instead throw some errors.. manually installing nukecss also don't solve.. however npm install github:patrickhulce/xo#master works but all tests fails out of the box:

> xo './lib/**/*.js' './test/**/*.test.js'

  test/index.test.js:13:27
  ✖   13:27  Unexpected function expression.  prefer-arrow-callback
  ✖   49:33  Unexpected function expression.  prefer-arrow-callback
  ✖   85:36  Unexpected function expression.  prefer-arrow-callback
  ✖  101:32  Unexpected function expression.  prefer-arrow-callback

  4 errors

maybe something to do with my node version? node v6.10.0

nukecss i get this output npm install nukecss-webpack

fontmin-webpack@0.0.0 /Users/milewski/Documents/Code/fontmin-webpack
└── (empty)

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "nukecss-webpack"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! path /Users/milewski/Documents/Code/fontmin-webpack/node_modules/nukecss/nukecss
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
milewski commented 7 years ago

i made a sample repository with the font and config im using

https://github.com/Milewski/bug-fontmin-webpack-bug

patrickhulce commented 7 years ago

I tried to run your tests but they all fail...

Yikes! I didn't realize yarn diverged so much in behavior from npm :/, yarn is what travis is using (and I use locally) to ensure consistent dependencies.

i made a sample repository with the font and config im using

Perfect thanks so much I'll dig in tonight!

patrickhulce commented 7 years ago

OK @Milewski I think I have a fix. It should publish as v1.0.1 once it passes CI. If you can give it a go to see if it fixes your issue, that'd be awesome.

milewski commented 7 years ago

@patrickhulce Thanks man! It works perfect now. where did you get docs on webpack? i constantly find myself trying to solve this kinds of issues but cant find enough docs on it.... going on the source code direcly takes too much time...

patrickhulce commented 7 years ago

Haha I wish there were an easy URL I could point you too! :) I mostly figured out what's happening reading the source, and using the node debugger.

protip: node --inspect --debug-brk ./node_modules/.bin/webpack + chrome://inspect === ❤️

patrickhulce commented 7 years ago

Marking as fixed then!