path_js_entry_script
is the location of the “entry” script in your project root
- e.g. the path to some
index.js
file, perhaps alongside apackage.json
file andnode_modules
directory
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
}