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

Can not import SurrealDB from browser #70

Closed
kevinkleine opened this issue Feb 1, 2023 · 3 comments
Closed

Can not import SurrealDB from browser #70

kevinkleine opened this issue Feb 1, 2023 · 3 comments

Comments

@kevinkleine
Copy link

Trying to import surrealdb script directly from the browser fails:

<script src="node_modules/surrealdb.js/esm/index.js" type="module"> </script>
gives
Uncaught TypeError: The specifier “isomorphic-ws” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

<script src="node_modules/surrealdb.js/script/index.js"></script>
gives
Uncaught ReferenceError: exports is not defined

How should I go about this?

@kearfy
Copy link
Member

kearfy commented May 5, 2023

Heya, I'm hoping that #46 will solve your issue :)

@kearfy
Copy link
Member

kearfy commented May 6, 2023

Hi! You should now be able to import the surrealdb.js library into your browser like this:

<script src="path/to/your/script.js" type="module">

Then for the actual script.js:

import Surreal from 'https://unpkg.com/surrealdb.js';
// OR
import Surreal from 'https://cdn.jsdelivr.net/npm/surrealdb.js';

Could you confirm if that solves your issue?

@kearfy
Copy link
Member

kearfy commented Jun 13, 2023

Hi, we have shipped the fix for this a while ago, but haven't gotten a confirmation back from you. Will close this as fixed!

@kearfy kearfy closed this as completed Jun 13, 2023
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

2 participants