selfrefactor / rambda

Faster and smaller alternative to Ramda
https://selfrefactor.github.io/rambda
MIT License
1.64k stars 89 forks source link

Unknown plugin "external-helpers" #60

Closed jpgorman closed 6 years ago

jpgorman commented 6 years ago

I've noticed that you now have to set the NODE_ENV variable in your process when using the package, otherwise you get the following error.

Module build failed: ReferenceError: Unknown plugin "external-helpers" specified in "/home/travis/build/jpgorman/react-append-to-body/node_modules/rambda/.babelrc.env.development"

selfrefactor commented 6 years ago

That may be the reason for a bug I have when using it with Parcel. Nice catch @jpgorman I will look into it.

selfrefactor commented 6 years ago

So, I have trouble reproducing this bug. I can confirm that I have seen the same error when I use Rambda with Parcel but when I opened issue there, it was admitted as bug on Parcel side.

This code doesn't produce the bug:

process.env = {}

const R = require('rambda')
console.log(process.env.NODE_ENV, R.add(1,1));

Let me know how I can reproduce it, as now it is hard for me to take an action.

jpgorman commented 6 years ago

Oops, sorry I should have done that when I raised the issue.

I've created a small repo that you can checkout that will reproduce the error : https://github.com/jpgorman/rambda-issue-60

If you run $ ./node_modules/.bin/webpack --config webpack.config.js -p you'll get the following error:

ERROR in ./node_modules/rambda/dist/rambda.esm.js
Module build failed: ReferenceError: Unknown plugin "external-helpers" specified in "C:\\Users\\Jean-Paul.Gorman\\projects\\rambda-issue-60\\node_modules\\rambda\\.babelrc.env.development"
jpgorman commented 6 years ago

I've used a webpack config as we need to transpile the es6 from the rambda library as part of the build chain.

I've then managed to resolve the issue by adding the export NODE_ENV=production && ./node_modules ......

So essentially it looks as though the development env for rambda has some missing dependencies, which show up when you build without specifiying the NODE_ENV as babel preset will default to the dev env if none is specified.

selfrefactor commented 6 years ago

Thanks for your input. I cloned your repo and it works as you described. So now I can play with '.babelrc' and figure out a solution.

selfrefactor commented 6 years ago

So according to https://babeljs.io/docs/usage/babelrc/ it defaults to development when no NODE_ENV is set. So now the build is requires NODE_ENV=build and thus we bypass the external-helpers issue.

Thanks for your efforts in closing this @jpgorman