Skip to content

v118

Compare
Choose a tag to compare
@ije ije released this 03 May 11:07
· 969 commits to main since this release

in v118, we added an experimental API that allows you to build a module with custom input(code).

import build, { esm } from "https://esm.sh/build"

const ret = await esm`
/* @jsx h */
import { h } from "[email protected]";
import { renderToString } from "[email protected]";
export default () => renderToString(<h1>Hello world!</h1>);
`

// use `build` function
const ret = await build({
  dependencies: {
    "preact": "^10.13.2",
    "preact-render-to-string": "^6.0.2"
  },
  code: `
    /* @jsx h */
    import { h } from "preact";
    import { renderToString } from "preact-render-to-string";
    export default () => renderToString(<h1>Hello world!</h1>);
  `
})

const { default: render } = await import(ret.url)
render() // "<h1>Hello world!</h1>"

// use bundled module
const { default: render } = await import(ret.bundleUrl)

Changelog:

  • feat: add custom build api (#607)
  • esm-cjs-lexer: Support __export(require("...")) pattern (close #611)
  • Add Auth middleware
  • Upgrade stableBuild to v118
  • Remove lit from stableBuild
  • Fix submodule types (close #606)
  • Fix arch for darwin arm64 (#617 by @JLugagne)