qnighy / node-cjs-interop

Babel plugin and helper functions for interoperation between Node.js native ESM and Babel ESM
MIT License
25 stars 1 forks source link

Possible to use for relative imports? #130

Open airhorns opened 2 months ago

airhorns commented 2 months ago

Thanks so much for putting together this series of plugins! They solve the exact problem I have, but, I have it within my own monorepo, both across local packages and for relative dynamic imports within them. Reading over the source it seems like a fixed list of top-level module names are required in the packages config. Any relative import gets back undefined from getPackageName, which means it can't ever be included in the list of packages in the config.

How hard would it be to:

If you could give me a little guidance on the best path forward and how to do it I can put together a PR!

qnighy commented 2 months ago

My assumption is that default exports get problematic only at package boundaries, because:

So, could you explain your use case here so that I can reconsider the assumption?