question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Production build breaks code that works in development

See original GitHub issue
import React from "react"

export default class App extends React.Component {
  render() {
    return (
      <div>
        <p>Parent</p>
        <AppItem />
      </div>
    )
  }
}

const AppItem = () => {
    return <div>child</div>
}

Works with npm start Breaks with npm build, giving Element type is invalid error

If you rearrange the code so that AppItem is defined before App (or you use a hoisted function declaration) it works in both environments.

I suspect this has something to do with the react inline elements transformer?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
sebmckcommented, Jul 26, 2016

I fixed this. babel/babel#3596

0reactions
gaearoncommented, Jul 27, 2016

This should be fixed in latest alpha. Please give it a try and let us know. https://github.com/facebookincubator/create-react-app/pull/190

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack works perfectly for development, but production ...
The issue comes about because in 'production' mode webpack performs optimizations that remove unreferenced code.
Read more >
How Does the Development Mode Work? - Overreacted
Bundling and running different code in development and production is powerful. In development mode, React includes many warnings that help ...
Read more >
The best webpack configurations for React applications
In this article, we will cover: Generic configurations for our app; Configurations specific to production and development only; Bundling and ...
Read more >
Overview of the Gatsby Build Process
JavaScript code can interact with the browser and take advantage of APIs it ... The gatsby develop command doesn't perform some of the...
Read more >
Deployment | Create React App
npm run build creates a build directory with a production build of ... It also works well when integrated into an existing server...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found