wmr icon indicating copy to clipboard operation
wmr copied to clipboard

Add Library Mode

Open Secretmapper opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. It's amazing how much functionality is packed into this tiny tool.

One thing I really like about vite is that it has a handy 'Library Mode', which allows you to build your package for distribution. It would be great if wmr has such functionality as well.

Describe the solution you'd like A config you can add in wmr.config.mjs

Secretmapper avatar Jul 26 '21 09:07 Secretmapper

For libraries, you can also use microbundle

ForsakenHarmony avatar Jul 26 '21 11:07 ForsakenHarmony

Indeed! (though I do think Microbundle could be much simpler)

developit avatar Jul 26 '21 13:07 developit

One thing that might be worth considering though, is that it'd be pretty easy for us to add a way to do additional Rollup builds, similar to what Vite provides with build.lib. We'd basically be adding some plugins to the provided options, and passing that on to Rollup here.

developit avatar Jul 26 '21 13:07 developit

Thanks for the recommendation regarding microbundle! Seems very useful!

One thing I really liked about wmr is that it's really small and has minimal dependencies. If I'm going to be using what is provided by wmr as a library, it'd be perfect.

One thing that might be worth considering though, is that it'd be pretty easy for us to add a way to do additional Rollup builds, similar to what Vite provides with build.lib. We'd basically be adding some plugins to the provided options, and passing that on to Rollup here.

Yes, this is specifically what I was thinking. My usecase is to separate my app into a monorepo. Having wmr have a library mode mean I can just have wmr in every package and build it there.

Addendum: Would it even be possible to support input files via the cli, so that it'd only be one dependency we can reference via '../../scripts' similar to how wmr and create-wmr builds? That would be 🔥

Secretmapper avatar Jul 27 '21 03:07 Secretmapper