-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only publish dist directory to NPM #2394
base: main
Are you sure you want to change the base?
Conversation
A couple thoughts here:
@matthieusieben any thoughts on this? |
Sourcemaps can still help with providing source-accurate line numbers in errors to my knowledge, though I guess that'd depend on environment?
Point taken, though the majority of these packages seem to be meant to run in node, where you usually wouldn't be bundling dependencies. I think the bigger issue with this setup is that TS will attempt to transpile any .ts files it finds imported under the root project's tsconfig, so if a dependent project has a tsconfig with e.g. different module settings than |
On sourcemapsFor sourcemaps to be really useful, the debugging tool (chrome debugger, Sentry, bundler, etc.) needs to have a way to reconstruct the source code. We could use TypeScript's inlineSources option instead of bundling the As a maintainer of the However, when it comes to the published version of the packages, I don't think that sourcemaps are actually that important. In my opinion, a stack trace in the built files is good enough for debugging purposes for users of our packages. When I personally debug other maintainers' packages in my node_modules, I always find it easier when there is a simple plain JS file (along with a Here is how some other popular tools address this:
TL;DR: I would be open to removing the
|
On bundlingWhile the practice of bundling is less frequent in back-end code, it is actually a good thing to do. node_modules contain lots of file that are not necessary in prod and actually make code execution slower (e.g. module resolution based on That being said, I don't believe that the published version of our packages should contain any unnecessary file. I have no clue how many people find the |
Another note on this — when source files are included in node_modules, TS will attempt to type check them with no way to disable that behaviour. As a result, unless the dependent project's module/import-related tsconfig settings are identical to those of the library, there'll be transpilation errors as it attempts to transpile the atproto dependency under the parent project's tsconfig settings. |
That shouldn't be the case though, as the If you encounter errors due to the declaration files, you might want to check TS's skipLibCheck) option. |
|
Another bundle size reduction PR (: this saves ~1/3 of bundle size in the case of @atproto/api by not publishing src and tests as part of the package. PR doesn't include bsync, bsky, dev-infra, lex-cli, ozone, and pds because I figured those wouldn't really have 3rd party dependents.
(you could save another 1/3 or so of the resultant bundle size by not generating sourcemaps but that's a bit more of a tradeoff)