Enigmatic-Smile / serverless-plugin-optimize

⛔️ DEPRECATED ⛔️ Bundle with Browserify, transpile and minify with Babel automatically to your NodeJS runtime compatible JavaScript
https://www.npmjs.com/package/serverless-plugin-optimize
MIT License
130 stars 54 forks source link

Add support for .babelrc file #18

Closed dwolfand closed 7 years ago

dwolfand commented 7 years ago

It would be nice if the babel configuration was pulled from .babelrc file which is generally the cleanest way to do it and will allow for other babel functionality like plugins etc

goncaloneves commented 7 years ago

I have never tried using .babelrc since I prefer plugin options inside serverless.yml.

So you tried and babelify did not pull .babelrc configuration? How was the setup? Share your .babelrc.

This issue https://github.com/babel/babelify/issues/151 may help.

dwolfand commented 7 years ago

Here's my .babelrc file, I imagine there are conflicts if we are defining the presets in two places. If there was a way to tell it to simply not use the babel params that would be helpful.

In fact, babel is often recommended to switch to the .babelrc file approach by default for reasons such as multiple plugins/libraries in a project needing to access the same babel configuration.

{
  presets: [
    "es2015-node4"
  ],
  plugins: [
    "transform-object-rest-spread"
  ]
}
goncaloneves commented 7 years ago

@dwolfand I didn't have time to test .babelrc as you mentioned. In that link it seemed that they set it inside browserify transform.

If both don't work together, then a pr to add support for Babel plugins is required. You are welcome to do a pr.