yotke
yotke

Reputation: 1208

Can't find the proper configuration for .babel and react-hot-loader

I'm using babel 7.

In their docs they mention the new naming for plugin is with @babel/ prefix.

React-hot-loader babrlrc config recommendation is:

{
  "plugins": ["react-hot-loader/babel"]
}

my .babelrc config is:

{
  "presets": ["@babel/env", "@babel/react"],
  "env": {
    "development": {
      "plugins": ["@babel/react-hot-loader"]
    },
    "production": {}
  }
}

Is it correct to assume that @babel/react-hot-loader is correct definision?

I could not find any more docs about it.

Upvotes: 0

Views: 803

Answers (3)

Owais Ahmed Qureshi
Owais Ahmed Qureshi

Reputation: 94

I don't think so, react-hot-loader does not update there docs for prefix definition and I also found there given example https://github.com/gaearon/react-hot-loader/blob/master/examples/typescript/.babelrc

Using babel 7 prefix for other plugins but for react-hot-loader still the same

{ "plugins": [ "@babel/plugin-syntax-typescript", "@babel/plugin-syntax-decorators", "@babel/plugin-syntax-jsx", "react-hot-loader/babel" ] }

Upvotes: 1

sxkx
sxkx

Reputation: 632

Saying @babel/react-hot-loader will have babel look within itself for a plugin called react-hot-loader. From what I can tell the package/plugin you're trying to use is not maintained/owned by babel itself. Therefore @babel/react-hot-loader will not work. You should configure your .babelrc as per the documentation of the plugin you're trying to use.

I think this is the plugin you're referring to in your question: react-hot-loader

Follow these setup instructions: react-hot-loader/getting-started

Upvotes: 2

Mohit Tilwani
Mohit Tilwani

Reputation: 2786

you have to still use it as mentioned in react hot reloader docs. below is the link

https://github.com/gaearon/react-hot-loader#user-content-add-babel-before-typescript

Upvotes: 1

Related Questions