bundle: false only includes entrypoint modules in output
Minimal reproduction: https://github.com/sentience/tsup-bundle-false-issue
export default defineConfig({
bundle: false,
format: ["esm"],
dts: true,
splitting: true,
entry: {
index: "src/index.ts",
},
})The bundle option is only documented as "Disable bundling" in the API docs, but what I (perhaps incorrectly) expected it to do was to output all modules referenced by my entry module(s), but not bundle them into the entry modules.
So if I had:
src/index.ts
export { foo } from './foo.js'src/foo.ts
export function foo() {
console.log("This is a function that should make it into the output of this package.")
}I would expect tsup to output two JavaScript files:
dist/index.mjs
import { foo } from "./foo.js"
export {
foo
}dist/foo.mjs
export function foo() {
console.log("This is a function that should make it into the output of this package.")
}Instead, tsup only outputs the first of those two files. The implementation of foo is left out of the build output entirely.
Is this really what bundle: false is supposed to do? If so, I don't understand what the use case for this option is.
My use case is to publish an ESM package with no bundling in order to maximise its tree-shakeability, assuming the consuming project will use a bundler to tree-shake dependencies and produce browser-ready bundles.
Source: egoist/tsup