hyper-sdk icon indicating copy to clipboard operation
hyper-sdk copied to clipboard

Add hyper-sdk-bundle.js to npm package

Open basham opened this issue 4 years ago • 2 comments

Thanks for adding hyper-sdk-bundle.js to the repo, in v3.0.10. However, can you also add it to the npm package? It would make it much easier to import it to projects if it was there, instead of copying and pasting it in the project source code.

basham avatar Sep 13 '21 15:09 basham

Yeah, having prebuild bundles seems like it'd make life easier for folks.

I was thinking of using github actions to publish the bundle inside the GitHub releases so people could either download or link to them directly.

Would that work for your use case? Would you be interested in editing the GH actions to enable it?

RangerMauve avatar Sep 15 '21 17:09 RangerMauve

I've never used GitHub actions. Is that something that I can test on a fork of this repo? I could see benefit to adding it to the releases page, although I would never use it.

My hope for this issue was as simple as adding "hyper-sdk-bundle.js" to the package.json "files" list.

For my use case, I'm using Snowpack as the build environment. I'd like to import the SDK from the npm package, so that it is directly included in the build process. I currently accomplish it like this:

// Copy the bundle to the project.
import './hyper-sdk-bundle.js'
// Access the SDK via window.
const SDK = window.hyperSDK

I'd prefer something like this:

import 'hyper-sdk/hyper-sdk-bundle.js'
const SDK = window.hyperSDK

In the long term, I'd prefer to have access to modules:

import SDK from 'hyper-sdk'

// Or:

import { SDK } from 'hyper-sdk'

basham avatar Sep 15 '21 17:09 basham