Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import error of CommonJS modules #53

Closed
greatpie opened this issue Jan 17, 2022 · 12 comments
Closed

import error of CommonJS modules #53

greatpie opened this issue Jan 17, 2022 · 12 comments

Comments

@greatpie
Copy link

when I run npm dev:

SyntaxError: Named export 'EthereumAuthProvider' not found. The requested module '@3id/connect' is a CommonJS module, which may not support all module.exports as named exports.
@jonathantcrawford
Copy link

Any idea when these templates will be working again?

@oed
Copy link
Member

oed commented Feb 16, 2022

@PaulLeCam Will this be fixed with the next release of the selfId sdk?

@PaulLeCam
Copy link
Collaborator

That seems like a setup issue, @jonathantcrawford what template is not working for you please?

@vindecodex
Copy link

when I run npm dev:

SyntaxError: Named export 'EthereumAuthProvider' not found. The requested module '@3id/connect' is a CommonJS module, which may not support all module.exports as named exports.

Same issue a run into, this was on nextjs template. @PaulLeCam

@vindecodex
Copy link

vindecodex commented Feb 17, 2022

i just make it worked by using require instead of direct usage of import.

error

import { EthereumAuthProvider, SelfID } from '@self.id/web';

no error

const _web = require('@self.id/web');
const { EthereumAuthProvider, SelfID } = _web;

I'm using NextJS

@kitakaze-kan
Copy link

kitakaze-kan commented Feb 17, 2022

Hi, I had same issue on Nextjs template.
It seems to be the same as vercel/next.js#30750 .

Downgrading Next@12.0.1 works for me.

Or, this method may work as well. (I haven't tried it yet.)

For note, with v12.0.4 & react-hook-form, it's only ok with esmExternals: false

@jonathantcrawford
Copy link

jonathantcrawford commented Feb 18, 2022

i just make it worked by using require instead of direct usage of import.

error

import { EthereumAuthProvider, SelfID } from '@self.id/web';

no error

const _web = require('@self.id/web');
const { EthereumAuthProvider, SelfID } = _web;

I'm using NextJS

@vindecodex where did you make this change in the nextjs template?

@jonathantcrawford
Copy link

Setting the next dependency to an explicit version worked for me.
"next": "12.0.1",

@kinshukk
Copy link

kinshukk commented Feb 20, 2022

Still getting this error, setting nextjs dependency doesn't work for me, I still get this:

SyntaxError: Named export 'EthereumAuthProvider' not found. The requested module '@3id/connect' is a CommonJS module, which may not support all module.exports as named exports

@bananaspliff
Copy link

if you can't publish notes after upgraded to 12.0.1 you need to enable chrome://flags/#unsafely-treat-insecure-origin-as-secure

@vindecodex
Copy link

i just make it worked by using require instead of direct usage of import.
error

import { EthereumAuthProvider, SelfID } from '@self.id/web';

no error

const _web = require('@self.id/web');
const { EthereumAuthProvider, SelfID } = _web;

I'm using NextJS

@vindecodex where did you make this change in the nextjs template?

i used nextjs npx create-next-app and not use the @self.id/framework instead i use @self.id/web and @self.id/core

@PaulLeCam
Copy link
Collaborator

I pushed new versions of the packages that remove the ESM setup, it works as expected for the self.id app and templates so hopefully this will fix the issues you're seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants