jxnblk / static-react

Zero-configuration CLI React static renderer
350 stars 29 forks source link

Add babelConfig parameter #5

Open leiming opened 8 years ago

leiming commented 8 years ago

babelconfig.json

{
  "plugins": ["transform-decorators-legacy"]
}

We can use the below command in order to using Decorators:

static-react RootComponent.js  -b babelconfig.json > index.html
jxnblk commented 8 years ago

Thanks, but is this even necessary? Won't it pick up a local .babelrc?

leiming commented 8 years ago

The problem of latest master version is static react only register the presets as https://github.com/jxnblk/static-react/blob/master/bin/static-react.js#L4-L8, but ignore the local .babelrc.

For example, my repo has the .babelrc as below:

{
  "presets": ["es2015", "react", "stage-1"],
  "plugins": ["transform-decorators-legacy"]
  }
}

executing static react will throw the error: React.js Decorators are not supported yet in 6.x pending proposal update dispite of having installed babel-plugin-transform-decorators-legacy.

If we pick up .babelrc by static-react -b .babelrc, That's all right! shall we support .babelrc ?

jxnblk commented 8 years ago

I think using .babelrc is the most standard way to go. Also think the flag should be -c --config as that seems more common.

leiming commented 8 years ago

All right.