21 ms·
Did not realize Bun had (even if rudimentary) macros - bundle time executing code support. That is pretty neat! https://bun.sh/docs/bundler/macros https://bun.s
by earslap 2y ago
Did not realize Bun had (even if rudimentary) macros - bundle time executing code support. That is pretty neat! https://bun.sh/docs/bundler/macros https://bun.sh/docs/bundler/macros
- Waterluvian 2y agoWow that’s pretty neat. Because of that I also learned about import attributes (https://github.com/tc39/proposal-import-attributes https://github.com/tc39/proposal-import-attributes) which is probably going to be quite useful and make the 50 lines of imports in some of my files look even dumber.
- Valodim 2y agoSome loaders already encode stuff in the path url style, e.g. vite-svg-loader import iconUrl from './my-icon.svg?url' Maybe I'm not imaginative enough but this seems like a reasonably restricted (i.e. simple) way of parametrizing imports.
- erhaetherth 2y agoThat's what I've been waiting for too. The URL params always seemed rather sketch to me. No bundlers seem to be using it that way though.
- agos 2y agothis is one of the most interesting new things in the bundler space - Parcel is introducing some form of macro too. It's way overdue to have some way to program what happens at bundling time (without writing your own bundler plugin)
- FlorianRappl 2y agoYes its neat - I wish more bundlers adopt it! In the past I've written a little plugin that is available for almost all bundlers allowing you to do that: https://dev.to/florianrappl/getting-bundling-superpowers-using-codegen-2no8 https://dev.to/florianrappl/getting-bundling-superpowers-usi...
- highmastdon 2y agoDidn’t Google’s closure compiler so something similar way before we had imports?