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

Provide browser compatible javascript package via CDN #3

Open
armaniferrante opened this issue Jan 5, 2021 · 11 comments
Open

Provide browser compatible javascript package via CDN #3

armaniferrante opened this issue Jan 5, 2021 · 11 comments

Comments

@armaniferrante
Copy link
Member

armaniferrante commented Jan 5, 2021

Would be nice to use the @project-serum/anchor package directly in the browser without a build step, i.e., via <script>.

@the-mercenaries-ltd
Copy link

is this possible with a build step at the moment?

@armaniferrante
Copy link
Member Author

Possible once we merge #1108.

@jeduan
Copy link
Contributor

jeduan commented Dec 7, 2021

Thinking out loud would the idea be that we create a full bundle with all the required dependencies? or would we expect users to, say add @solana/web3 in a separate script tag?

@armaniferrante
Copy link
Member Author

A separate tag would be nice if there's any reason to have different versions (or even web3 libraries in the future), though I can't think of any examples where that would be useful atm.

@mrmizz
Copy link

mrmizz commented Jan 24, 2022

any update here? 🙇

@rmdorsey
Copy link

Was a browser bundle created for anchor? I can't find it...

@mrmizz
Copy link

mrmizz commented Apr 22, 2022

Was a browser bundle created for anchor? I can't find it...

nope. you'll have to bundle yourself. here's my implementation for reference

@rmdorsey
Copy link

@rmdorsey
Copy link

this didn't work for me: https://unpkg.com/@project-serum/anchor@latest

@mrmizz , I'll try it your way. What's the process for creating a browser bundle? Is there a tutorial you can recommend?

@mrmizz
Copy link

mrmizz commented Apr 25, 2022

@rmdorsey like yourself I did not have experience with browser bundles until I started developing with anchor-lang.
I found rollup.js by reading the anchor codebase. that's what they use for bundling their assets as well. read the docs I linked. I went from nothing to a successful build in a couple hours. you can use my previous link to my src as a reference implementation.

@SkyYap
Copy link

SkyYap commented Nov 7, 2022

It looks like somebody already did it? https://unpkg.com/@project-serum/anchor@latest

Hi, I tried to use anchor on WebGL and found out WebGL can't install npm. For @solana/web3.js, I have successfully import the browser bundle following their tutorial in Getting Started -> Installation -> Bundle.

I spot Browserify unpky skypack.dev tools provide feature that turn npm packages to browser bundle but all of these file and can't load on my browser. Tried the above unpkg too and it doesn't work too. Anyone can help me?

vadorovsky added a commit to vadorovsky/anchor that referenced this issue May 11, 2023
We are going to use this for generating IDL in Light Protocol, so we
will most likely also release it on crates.io (and maybe npmjs.org) and
make Docker images based on it.

Therefore, to avoid name collision, we need to change the names of
crates in the least intrusive way. This change gives the `light-` prefix
to all crates which are going to be published. Using them with the
`package` option in Cargo.toml, like:

```
anchor-syn = { version = "0.27.0", package = "light-anchor-syn" }
```

is going to work as drop-in replacement for upstream Anchor without any
necessity to change import paths (`use anchor_syn`).

Also, mention the purpose of the fork in README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants