ReferenceError: App is not defined
See original GitHub issueWhen starting up my dev server with the latest version of next-translate
, I ran into this webpack issue:
ReferenceError: App is not defined at eval (webpack-internal:///./pages/_app.js:185:1)
After some debugging, It seems to have something to do with the App.propTypes
in the _app.js
file, when exporting the App
while defining it:
import PropTypes from "prop-types";
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />
}
App.propTypes = {
Component: PropTypes.any,
pageProps: PropTypes.any,
}
I managed to narrow it down to a minimal reproducible example. You can find my repository here.
It’s based on the simple example of the next-translate example directory. Hopefully the comments in the _app.js
and next.config.js
files are clear enough to reproduce the issue!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
ReferenceError: app is not defined: node.js - Stack Overflow
Error message is pretty clear. app variable is not defined, so obviously you can not use it. Check example from the link in...
Read more >ReferenceError: App is not defined · Issue #488 - GitHub
When starting up my dev server with the latest version of next-translate, I ran into this webpack issue: ReferenceError: App is not defined...
Read more >ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
ReferenceError : "x" is not defined. The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >uncaught reference error: App is not defined - Treehouse
render( <App />, document. getElementById("root") ); this shows an uncaught reference error saying App wasn't defined. However, when I copied ...
Read more >Referenceerror message is not defined Node js
Reference Error [variable] is not defined. In some cases, this can be simply referring to a variable that isn't defined (perhaps the most...
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 Free
Top 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
Until a fix is released and in case it helps anyone -
I had a similar issue and found out this can be worked-around by not directly exporting the
App
component from_app
file.In my case, changing from this:
to this:
Solved the error.
@jellebouwman @giladaya @justirva09 @j-schumann The idea of 2.0 version is to change the regular expressions in a better way. Currently, there are 2 proposals: with Babel parser and with TypeScript compiler.
We need feedback from the people to decide which one corrects more errors and does not generate new ones.
This bug should be fixed with the new version Can you test these two prereleases and give feedback?
With Babel: 2.0.0-experimental.1
With TypeScript compiler: 2.0.0-experimental.2
You can use this discussion to write your feedback:
https://github.com/aralroca/next-translate/discussions/881
Thank you so much!