nksaraf / vinxi

The Full Stack JavaScript SDK
https://vinxi.vercel.app
MIT License
1.33k stars 56 forks source link

package import issue #256

Open L-Blondy opened 3 months ago

L-Blondy commented 3 months ago

Hi there,

using solid start with "vinxi": "0.3.10" when I do this:

import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider"

I get this error:

[h3] [unhandled] SyntaxError: [vite] Named export 'EthereumPrivateKeyProvider' not found. 
The requested module '@web3auth/ethereum-provider' is a CommonJS module, 
which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@web3auth/ethereum-provider';
const {EthereumPrivateKeyProvider} = pkg;

If I do as said in the error message

import pkg from '@web3auth/ethereum-provider';
const {EthereumPrivateKeyProvider} = pkg;

I get a runtime error

Uncaught SyntaxError: The requested module 
'/_build/node_modules/.vinxi/client/deps/@web3auth_ethereum-provider.js?v=dc030315' 
does not provide an export named 'default'

Tried it with Vite then with Next.js, import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider" works fine, no error message.

Here is a repro of the issue: https://codesandbox.io/p/devbox/vjs6rv?file=%2Fsrc%2Fapp.tsx%3A9%2C16