You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, our packages are bundled with ESBuild. This has some strange consequences.
For example, although @code-pushup/cli depends on other packages like @code-pushup/utils via dependencies in package.json, the distributed cli package actually doesn't import any of our other packages, their code is included in the index.js or bin.js bundle. The reason ESBuild doesn't treat other @code-pushup packages as external dependencies is because the imports are treated as relative paths after resolving TypeScript path aliases.
This leads to weird cases like the #834 bug - the @code-pushup/cli source code doesn't directly import vscode-material-icons (hence why it should be OK that it's not in its package.json), but in the bundled code it is imported directly (hence why Yarn 4 complains about it).
Also, bundling the package into one huge file makes it harder to diagnoze errors reported by customers, because the error stack just shows some random line in the massive index.js file, so it's harder to link to our source code.
Proposal
Our packages are for Node only, not the browser. Therefore it doesn't make sense to use a bundler. All we need is to transpile .ts files to .js and .d.ts files, so plain old tsc should suffice.
The problem
Currently, our packages are bundled with ESBuild. This has some strange consequences.
For example, although
@code-pushup/cli
depends on other packages like@code-pushup/utils
viadependencies
inpackage.json
, the distributedcli
package actually doesn'timport
any of our other packages, their code is included in theindex.js
orbin.js
bundle. The reason ESBuild doesn't treat other@code-pushup
packages as external dependencies is because the imports are treated as relative paths after resolving TypeScript path aliases.This leads to weird cases like the #834 bug - the
@code-pushup/cli
source code doesn't directly importvscode-material-icons
(hence why it should be OK that it's not in itspackage.json
), but in the bundled code it is imported directly (hence why Yarn 4 complains about it).Also, bundling the package into one huge file makes it harder to diagnoze errors reported by customers, because the error stack just shows some random line in the massive
index.js
file, so it's harder to link to our source code.Proposal
Our packages are for Node only, not the browser. Therefore it doesn't make sense to use a bundler. All we need is to transpile
.ts
files to.js
and.d.ts
files, so plain oldtsc
should suffice.Acceptance criteria
@nx/esbuild:esbuild
executor with@nx/js:tsc
The text was updated successfully, but these errors were encountered: