0

I have a Lightning Web Component (LWC) which has a .html, .css, and .js file. I wish to measure the bundle size of this one component.

To do so, I wish to bundle my component using rollup. And then measure the bundled file size using some 3rd party library.

But how do I use rollup in this context? I see there are many plugins required... I could not seem to find examples online where the developer is bundling all three: .html, .css, and .js. What would my rollup.config.js file consume for its plugins, and what would this file even look like?

1 Answer 1

1

This may not be the exact answer you want, but I think it would save you a lot of headaches in the long run.

I would highly recommend using vite. Not only does it use rollup under the hood, but it will also will show you the size of the bundle when you build it.

Considering that you are making a web component, you would likely build it as a library, and there is a guide for that here that details exactly how to do that.

Without seeing the code, I don't thing I can give you much more help, but their documentation is very good, and it is very easy to set up with npm, yarn, and pnpm.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.