Production build breaks code that works in development
See original GitHub issueimport 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:
- Created 7 years ago
- Reactions:2
- Comments:14 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I fixed this. babel/babel#3596
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