Next 12.2 ReferenceError: exports is not defined
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Next 12.2(-12.2.2)
Describe the Bug
I’m no longer able to import code with exports
properly in Next 12.2
Expected Behavior
Next should properly bundle these files
Link to reproduction
https://github.com/hanford/12.2-exports
To Reproduce
Pull reproduction repo and try running on Next 12.2.0
, you’ll see the following error:
You can check out the working
branch, which just has Next 12.1.6
, after installing the older version the code will run without error.
–
Happy to provide more information if it’s helpful!
Issue Analytics
- State:
- Created a year ago
- Reactions:9
- Comments:16 (8 by maintainers)
Top Results From Across the Web
ReferenceError: exports is not defined error in Next.js
Looks related to this GitHub issue github.com/vercel/next.js/issues/38117, seems to have been introduced in the 12.2.0 release. Try downgrading ...
Read more >How to fix ReferenceError: exports is not defined TypeScript
If you are getting the error for code that runs in the browser, try defining a global exports variable above the script tags...
Read more >referenceerror: module is not defined in es module scope this ...
ReferenceError : exports is not defined in ES module scope This file is being treated as an ES module because it has a...
Read more >ReferenceError: exports is not defined in TypeScript | bobbyhadz
To solve the "Uncaught ReferenceError: exports is not defined", add a script tag that defines an exports variable, e.g. <script>var exports = {};</script>...
Read more >Uncaught ReferenceError: exports is not defined : r/typescript
Uncaught ReferenceError: exports is not defined · use module: "es6" in the tsconfig, so that the generated modules code runs natively in browsers....
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
We’re running into the same thing. It was working before on version 12.1.6.
Can confirm that this was working before 12.2, we use next-transpile-modules to bring in mixed modules and they worked just fine up until 12.2