hyperx icon indicating copy to clipboard operation
hyperx copied to clipboard

Publish as UMD bundle

Open jrop opened this issue 7 years ago • 4 comments

Publishing as a UMD bundle allows for easy use in HTML pages via unpkg:

<script src="https://unpkg.com/[email protected]/dist/hyperapp.js"></script>
<script src="https://unpkg.com/hyperx@latest/dist/hyperx.min.js"></script>
<script>
  const {app, h} = hyperapp
  const hx = hyperx(h)
  const main = app(
    {}, // state
    {}, // actions
    () => hx`<div>Hello from HyperX!</div>`,
    document.getElementById('root')
  )
</script>

This change is completely backward-compatible and supports:

  • [x] CommonJS (require('hyperx') still works)
  • [x] AMD
  • [x] library exported as window.hyperx when included via a <script> tag

This mirrors how React is publishing their module as well. See: https://unpkg.com/[email protected]/cjs/

jrop avatar Jan 02 '18 18:01 jrop

This would be really nice

tsjnsn avatar Feb 26 '18 18:02 tsjnsn

@tsjnsn For the moment, I published a single version of a UMD build of this package here:

https://www.npmjs.com/package/@jrop/hyperx

I still would like to have this merged though :/

jrop avatar Feb 26 '18 18:02 jrop

personally i'm cool with publishing UMD builds. I know not everyone in the choojs org likes em tho. you can also use https://wzrd.in/standalone/hyperx which browserifies a UMD build on the fly.

goto-bus-stop avatar Feb 26 '18 19:02 goto-bus-stop