3 ms·
To tackle this, I always needed to write a little script for my TypeScript projects that were all being published as ESM: https://github.com/virtualstate/promi
by fabiancook 4y ago
To tackle this, I always needed to write a little script for my TypeScript projects that were all being published as ESM:
https://github.com/virtualstate/promise/blob/main/scripts/correct-import-extensions.js https://github.com/virtualstate/promise/blob/main/scripts/co...
https://github.com/virtualstate/focus/blob/main/scripts/correct-import-extensions.js https://github.com/virtualstate/focus/blob/main/scripts/corr...
https://github.com/virtualstate/navigation/blob/main/scripts/correct-import-extensions.js https://github.com/virtualstate/navigation/blob/main/scripts...
This same script was replicated to near every repository I have worked on, including making its way into a few different production services where Node.js + ESM was used for deployment
Eventually I had turned into a utility module that could be used wider, which starts to lean into import map generation
https://github.com/virtualstate/impack#usage https://github.com/virtualstate/impack#usage
You can see it being used here as a function, but can be used as a cli tool too:
https://github.com/virtualstate/listen/blob/033bf8effcbde5c825851516bd651fdc1bd13680/scripts/post-build.js#L7-L14 https://github.com/virtualstate/listen/blob/033bf8effcbde5c8...