No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


npm i babel-plugin-react-inline-sfc

Inline (sort-of) your stateless functional components.

I'm not sure how much is this going to speed up typical react application with lots of HOCs so if you can, please try & report your results

.babelrc (or babel options)

"plugins": [..., "react-inline-sfc"],


  • you have to npm run eject before

  • then edit package.json and update babel field to look like:

    "babel": {
      "presets": [
      "plugins": ["react-inline-sfc"]

How it works

  • replace <Comp ... with _Comp(...)
  • define _Comp (during load) as reference to Comp if it
    • is SFC
    • does not rely on context


Babel plugins are not aware of modules (and transpilation does not happen in the right order either) so it's not possible to do real inlining. But it is possible to do this during page load.

Debug (create-react-app)

NODE_ENV=development node --inspect-brk ./node_modules/.bin/webpack --config config/

cacheDirectory: false