You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a module that tries to import a named export from postgrest-js:
echo 'import { PostgrestClient } from "@supabase/postgrest-js"' > test.mjs
Try to run the module with node:
node test.mjs
4. Note the error trying to import a commonjs module.
## Expected behavior
I expect the above import to work and import an ESM module.
## Screenshots
❯ node test.mjs
file:///.../test.mjs:1
import { PostgrestClient } from "@supabase/postgrest-js"
^^^^^^^^^^^^^^^
SyntaxError: Named export 'PostgrestClient' not found. The requested module '@supabase/postgrest-js' 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 '@supabase/postgrest-js';
const { PostgrestClient } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
Node.js v19.6.0
## System information
- Version of supabase-js: 1.4.1
- Version of Node.js: v19.6.0
## Additional context
It appears that node only looks at the `main` entrypoint in `package.json`, and not `module`. It also specifies a newer and more complex way of specifying see [here](https://nodejs.org/api/packages.html#package-entry-points) for details.
The text was updated successfully, but these errors were encountered:
I'm hitting this over and over with postgrest-js trying to use it in different environments. To get my code to work, I have to use all 3 of these in different contexts:
import { PostgrestClient } from '@supabase/postgrest-js';
^^^^^^^^^^^^^^^
SyntaxError: The requested module '@supabase/postgrest-js' does not provide an export named 'PostgrestClient`
Supabase ships so much amazing software. Could we get a fix for this?
Bug report
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
❯ node test.mjs
file:///.../test.mjs:1
import { PostgrestClient } from "@supabase/postgrest-js"
^^^^^^^^^^^^^^^
SyntaxError: Named export 'PostgrestClient' not found. The requested module '@supabase/postgrest-js' 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 '@supabase/postgrest-js';
const { PostgrestClient } = pkg;
Node.js v19.6.0
The text was updated successfully, but these errors were encountered: