esbuild
esbuild copied to clipboard
Yarn workspace: esbuild not bundling internal library
Hi !
I'm building an app with esbuild. The app (workers) is relying on some internal library (utils). But, after bundling, nothing of utils can be found in my bundled index.cjs.
Here is my file tree:
root
├── workers
│ ├── build
│ │ └── index.js
│ ├── src
│ │ └── index.ts
│ └── package.json
├── utils
│ ├── src
│ │ └── index.ts
│ └── package.json
└── package.json
Here is my root package.json:
{
"name": "XXXX",
"version": "0.0.0",
"license": "MIT",
"private": true,
"workspaces": [
"workers",
"utils"
]
}
Here is my utils/package.json:
{
"name": "utils",
"version": "1.0.0",
"main": "src/index.ts",
"license": "MIT",
"private": true,
"dependencies": {
...
}
}
Here is my workers/package.json:
{
"name": "workers",
"version": "1.0.0",
"main": "build/src/index.js",
"type": "module",
"scripts": {
"build": "node build.js",
"start": "node build/index.cjs"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"esbuild": "^0.25.1"
},
"dependencies": {
...,
"utils": "*"
}
}
And here is my build script:
import * as esbuild from "esbuild";
await esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
outfile: "build/index.cjs",
platform: "node",
loader: { ".node": "file", ".html": "text" },
});
Any idea how to get utils libray to be bundled with my workers app ?
I cannot reproduce what you said. Maybe you can provide a runnable reproduction? Here's what I tried: esbuild-4120.zip
Closing due to lack of a reproduction.