privatenumber / pkgroll

📦 Zero-config package bundler for Node.js + TypeScript
MIT License
1.01k stars 23 forks source link

feat: tsconfig paths support #48

Open mjgerace opened 6 months ago

mjgerace commented 6 months ago

Feature request

I understand that pkgroll is based off of package.json config - however, it would be really nice to have a build system that operates exactly like tsx. I use tsx for dev, since the watch/file execution is the fastest i've found by far. However, this means that I must use something like tsup, or ts-node for actual production building.

This is a concern for me, as tsx auto-configures, but these other libraries do not. I want as few deviations as possible between my dev environment with tsx and the production build for obvious reasons - I want a similar output format, build process, etc to reduce the chance of production-build-only bugs.

One major way to close this gap is to support tsconfig paths. Today, wildcard matching paths isn't possible with package.json.

Motivations

Closing the gap between my dev and full build process.

Alternatives

No response

Additional context

No response

Contributions

privatenumber commented 6 months ago

Yeah I agree, alias support via tsconfig.json would be great! pkgroll is about zero-config by leveraging existing configurations.

PR welcome

samal-rasmussen commented 5 months ago

Ah. I have two entries in my paths:

"services/*": ["./src/services/*"],
"shared/*": ["./src/shared/*"]

And now trying pgkroll I get a lot of errors like this: "shared/models/product.model" is imported by "src/db/product.db.ts", but could not be resolved – treating it as an external dependency.

I've been running with tsx, but wanted to do bundling now because of some infrastructure limitations. I will try Rollup.

olee commented 2 months ago

Is there even any way to get this working right now by using package.json imports configuration with full directories? Because it seems that imports only supports singlular files.