Uncaught ReferenceError: exports is not defined at version 3.3.18 and Parcel
See original GitHub issueIntended outcome:
The version of @apollo/client
is upgraded from 3.3.17 to 3.3.18 safely and the built application is running without issues.
Actual outcome:
After upgrade and build without issues, the application fails from the start with a blank page and an error in console:
Uncaught ReferenceError: $24a7145fde937c9e5b0a055eaa64c5e1$exports is not defined
How to reproduce the issue:
- Set dependencies:
"@babel/core": "^7.10.1",
"@parcel/config-default": "^2.0.0-beta.1",
"@parcel/transformer-typescript-tsc": "^2.0.0-beta.1",
"@parcel/validator-typescript": "^2.0.0-beta.1",
"parcel": "^2.0.0-beta.1",
"@apollo/client": "3.3.18",
- Parcel config
.parcelrc
:
{
"extends": "@parcel/config-default",
"transformers": {
"*.{ts,tsx}": ["@parcel/transformer-typescript-tsc"]
}
}
- tsconfig.json
{
"compilerOptions": {
"target": "es6",
"resolveJsonModule": true,
"module": "commonjs",
"jsx": "react",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"moduleResolution": "node",
"baseUrl": "./src",
"paths": {
"~/*": ["./*"]
},
"types": [
"./src/models",
"node",
"jest"
],
"esModuleInterop": true,
"experimentalDecorators": true,
"skipLibCheck": true
},
"exclude": ["dist/**", "node_modules/**.*"]
}
- Run build command
npx parcel build src/index.html
- Run with Nginx (if it matters) and open in browser
Versions
System:
OS: macOS 11.5
Binaries:
Node: 16.6.1 - /usr/local/bin/node
Yarn: 1.22.10 - ~/stockX/viper/node_modules/.bin/yarn
npm: 7.20.5 - /usr/local/bin/npm
Browsers:
Chrome: 92.0.4515.159
Firefox: 90.0.2
Safari: 14.1.2
npmPackages:
@apollo/client: 3.3.18 => 3.3.18
@apollo/link-error: ^2.0.0-beta.3 => 2.0.0-beta.3
apollo: ^2.31.0 => 2.32.1
react-apollo: 3.1.5 => 3.1.5
I assume that this PR that corresponds this patch may still miss some side effects and should include some dependencies to avoid their truncation. Since I have the same error but on other line of code if upgrading to 3.4.8, I assume that there could be more side effects.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
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 >Typescript ReferenceError: exports is not defined
Trying to implement a module following the official handbook, I get this error message: Uncaught ReferenceError: exports ...
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 >exports is not defined in es module scope lambda - You.com
undefined ERROR Uncaught Exception { "errorType": "ReferenceError", ... The old versions of JavaScript had no import, include, or require, so many different ...
Read more >@apollo/client | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
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 also searched for
onClearStore
throughout the codebase, we don’t use it. So I hope it is not the reason.@irenlian Can you share the stacktrace leading to that
ReferenceError
?