Lattyware / elm-fontawesome

FontAwesome for Elm.
https://package.elm-lang.org/packages/lattyware/elm-fontawesome/latest/
MIT License
33 stars 6 forks source link

"flatMap is not a function" when attempting to build #3

Closed Herteby closed 5 years ago

Herteby commented 5 years ago

Seems like my version of Node doesn't have Array.prototype.flatMap Node v 10.3.0 NPM v 6.1.0

I see you have Babel, but maybe the config should be updated?

Herteby commented 5 years ago

I tried changing "browserslist", but it didn't seem to make a difference. I got it working though by importing lodash.flatMap and using that instead.

Very cool btw that unused icons can be automatically removed! :smile: Something I've wanted for a long time, but which is of course impossible with JS's dynamic nature.

Lattyware commented 5 years ago

Yeah, I took a look - you should be able to fix with an import of import "core-js/fn/array/flat-map"; rather than lodash - babel wasn't doing it even with the browserslist changed as it's a staged proposal which env won't automatically deal with - I'm adding a build that'll test other versions to keep us honest, although it's currently blowing up on the private packages.

Yeah, the new version of Elm took a long time to come around, but the ability to minify so effectively is really useful, especially in cases like this.

Lattyware commented 5 years ago

OK, there is now a working build testing we can get compilable Elm output on node versions 6, 8, 10 and 11, and there is actually a nicer fix than the one I mentioned - there is a shippedProposals setting for Babel that allows it to insert the flat-map polyfill as needed, so no need to add it in manually.