Skip to content
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

Simplify the npm package files #572

Open
tkrotoff opened this issue May 7, 2024 · 2 comments
Open

Simplify the npm package files #572

tkrotoff opened this issue May 7, 2024 · 2 comments

Comments

@tkrotoff
Copy link

tkrotoff commented May 7, 2024

The generated npm package contains files that are randomly named like chunk-GUY7XK43.mjs. Please make the npm package files human friendly.

This makes the source code difficult to debug (in the context of an application that uses @mswjs/interceptors via node_modules).

I had a hard time finding a performance issue with JSDOM because of this: https://github.com/tkrotoff/jsdom-slow-URL-parsing

image
@kettanaito
Copy link
Member

Hi, @tkrotoff. Thanks for raising this.

What chunk format would you consider more friendly?

Note, these are automatically generated by tsup. We can change the chunk name pattern but they will always be named somewhat randomly (right now it's based off the chunk's hash). The chunks are also correctly split since you want granular modules to have granular imports in ESM.

If you can tell me more about the issue you've experienced, the way you tried to debug, and the way that actually worked, that would help me in making the right decision here. Thanks.

@tkrotoff
Copy link
Author

What chunk format would you consider more friendly?

No chunks

tsup

I've never used tsup nor needed it for my libraries, maybe it's not a great tool, maybe you don't need it.

For example, you don't need to ship the .map files (source maps): you don't need to minify the code and Node.js knows recent ES features so the original code and the bundled code are almost identical.
You also don't need to ship the original TypeScript source code.

the way you tried to debug

You have a performance issue (https://github.com/tkrotoff/jsdom-slow-URL-parsing).
You put console.log, console.time, IDE breakpoints in your code + in node_modules to understand what's going on.
Having multiple files (in node_modules) named randomly with indirections makes it hard and error-prone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants