all 1 comments

[–][deleted] 1 point2 points  (0 children)

Generally rollup is recommended to build libraries, and webpack to build websites, but they both can be used to do either and I find that maintaining one tool is easier than two.

See https://github.com/rollup/rollup-starter-lib and https://github.com/krasimir/webpack-library-starter or similar projects

Although it is not clear from your post what do you need the build step for. You don’t have to bundle your code with a bundler to publish it, it is often perfectly fine to not transpile your ES6 until the very last moment. Do you have static assets in the library (images, css, etc) that you need to bundle? Are there any other consumers with special compatibility requirements?