hyperx
hyperx copied to clipboard
Publish as UMD bundle
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/
This would be really nice
@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 :/
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.