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.

exports not defined

See original GitHub issue

I’m getting the following error when importing from svelte-web3

exports is not defined ReferenceError: exports is not defined

Here is more detailed logs

1:04:38 PM [vite] Error when evaluating SSR module /node_modules/svelte-proxied-store/dist/store.js?v=648dcf98:
ReferenceError: exports is not defined
    at eval (/node_modules/svelte-proxied-store/dist/store.js?v=648dcf98:5:23)
    at instantiateModule (C:\Users\antho\Desktop\Code\Tutorials\MyDapp\node_modules\vite\dist\node\chunks\dep-76613303.js:60094:15)
1:04:38 PM [vite] Error when evaluating SSR module /node_modules/svelte-web3/src/stores.js:
ReferenceError: exports is not defined
    at eval (/node_modules/svelte-proxied-store/dist/store.js?v=648dcf98:5:23)
    at instantiateModule (C:\Users\antho\Desktop\Code\Tutorials\MyDapp\node_modules\vite\dist\node\chunks\dep-76613303.js:60094:15)
1:04:38 PM [vite] Error when evaluating SSR module /src/routes/index.svelte:
ReferenceError: exports is not defined
    at eval (/node_modules/svelte-proxied-store/dist/store.js?v=648dcf98:5:23)
    at instantiateModule (C:\Users\antho\Desktop\Code\Tutorials\MyDapp\node_modules\vite\dist\node\chunks\dep-76613303.js:60094:15)

This is when importing from a newly instantiated SvelteKit project. Here is the code in my <script> tag:

        // IMPORT THESE
	import { browser } from '$app/env';
	import { defaultEvmStores, web3, selectedAccount, connected, chainId, chainData } from 'svelte-web3';

	// This will only render client-side if the browser is available.
	if(browser) {
		defaultEvmStores.setBrowserProvider();
	}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
clbrgecommented, Jan 1, 2022

Please upgrade to svelte-web3 version 3.0.2 . That should solve all Vite problems… Thanks for taking the time to report the issue!

0reactions
pythonicodecommented, Jan 1, 2022

No it works with JavaScript and that’s how i use it myself. Is there a way you could share your repo that shows that errors ?

I just published it here: https://github.com/PythoniCode/MyDapp

Thanks for looking into it so quickly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript ReferenceError: exports is not defined
I had the error "exports is not defined" coming from an imported NPM module. Changing my typescript config did nothing as I had...
Read more >
How to fix ReferenceError: exports is not defined TypeScript
Solution. If you are getting the error for code that runs in the browser, try defining a global exports variable above the script...
Read more >
Uncaught ReferenceError: exports is not defined : r/typescript
Getting this error for some dumb reason i'm sure. Uncaught ReferenceError: exports is not defined. at app.js:2. (anonymous) @ app.js:2. all ...
Read more >
exports is not defined" in browser : WEB-26773 - YouTrack
When I compile Typescript files with IntelliJ (using "Enable typescript compiler" or clicking the Compile button), the generated js-file does not seem to ......
Read more >
exports is not defined · Issue #7128 · vitejs/vite - GitHub
exports is not defined #7128 ... from '@rollup/plugin-inject' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], ...
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