import { anything } from 'something'
anything()
/* Bun.serve may not be a requirement, but I'm using it. */
Bun.serve({
fetch(req) { return new Response('Hi!') }
})
the resulting out/index.js file will include built code for statSync and cwd. Is this expected?
Furthermore, if the someFunction() code has it's own calls to Bun.build(), for one-off files I need to build, and those files have even a single import of their own, their resulting filename.js output will also include the statSync and cwd built code. If those one-off files don't have any imports, the statSync and cwd code is not included with their built code.
Running the build with the option target set to either "bun" or "node" resolves the issue. Running it with the default of browser is what causes the issue.
What version of Bun is running?
1.1.26
What platform is your computer?
WSL
What steps can reproduce the bug?
What is the expected behavior?
The imports and globals from the plugin's top-level imports should not be included in the built index.js file, nor any other one-off built files.
What do you see instead?
With a plugin including something like this,
where
someFunction
has a global import or a global [const | var | let],and an index.ts file of
the resulting
out/index.js
file will include built code forstatSync
andcwd
. Is this expected?Furthermore, if the
someFunction()
code has it's own calls toBun.build()
, for one-off files I need to build, and those files have even a singleimport
of their own, their resultingfilename.js
output will also include thestatSync
andcwd
built code. If those one-off files don't have any imports, thestatSync
andcwd
code is not included with their built code.Additional information
No response