path_js_entry_script is the location of the “entry” script in your project root
- e.g. the path to some
index.jsfile, perhaps alongside apackage.jsonfile andnode_modulesdirectory
NOTES:
- disables “environment variable injection” for enhanced security and predictability
- assume a single entry point that generates a single build artifact
- you can pass in custom build options that will override the defaults
const async_build_js_script = async function (path_js_entry_script, build_options) { const result = await Bun.build({ entrypoints: [ path_js_entry_script ], env: 'disable', minify: false, ...build_options, }) const str_out = await result.outputs[0].text() return str_out}