-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
TypeScript build tool that maps require('mymodule/foo')
into './src/foo.ts'
#130
Comments
This can be done in the |
Hi @Richienb, thanks for the fast response!! I may look into it later. @lifeiscontent, what do you think? |
@Richienb I'd love to see an example, its hard to visualize as I don't have a full understanding of the ecosystem of rollup. |
The |
You can solve this with the |
@sindresorhus is this functionality that will work out of the box right now? or something that could be implemented in rollup as a potential feature? |
There's no need to use Rollup at all. |
Ohhhh, I misunderstood the question. I thought you wanted to remap imports from within the module itself on build time, like this rejected TypeScript request: microsoft/TypeScript#15479. |
Ahhh!! Awesome! Thank you all very much!! @Richienb I was lucky that you misunderstood, because that TS issue you just linked happened to help me with something else here 😅 |
Rewording the request by @lifeiscontent here:
Consider the following TypeScript project that will be distributed as a npm package:
Compiling this will generate
./dist/index.js
and./dist/utils.js
. To import the module,require('the-module')
works as long as themain
field ofpackage.json
is setup correctly, which is fine and very common to do. However, there is no good way to also provide./utils.ts
directly asrequire('the-module/utils')
. Instead, people would have to dorequire('the-module/dist/utils')
which is ugly.There could be a command line utility to be called within
prepack
that:pirates
on theindex.js
file.Thoughts?
The text was updated successfully, but these errors were encountered: