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

Setup without build tools #1363

Open
zzph opened this issue Jan 31, 2024 · 1 comment
Open

Setup without build tools #1363

zzph opened this issue Jan 31, 2024 · 1 comment

Comments

@zzph
Copy link

zzph commented Jan 31, 2024

Hi there,

I’m trying to integrate using this within a Chrome Extension as part of a service worker.

  • From this repo, create a minified build of the latest version of gun.js
  • Put that minified file into my project, then import it in my service worker as ‘var gun = importScripts(“./gun.js”)’

I get the welcome message (“Hello wonderful person...”), but I cannot use the library as "gun" is undefined.

Without build tools, what's the correct way to import/use this library?

Ps brilliant work on this @amark !

@zzph zzph changed the title Basic setup: using importScript (no npm) Setup without build tools Jan 31, 2024
@amark
Copy link
Owner

amark commented Feb 4, 2024

I believe @bmatusiak has a fix for this in github master, not in npm yet, but you can manually shim meanwhile if you want for serviceworkers by doing window = self before import I think. Sorry!

THanks!

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