Giter Club home page Giter Club logo

Comments (8)

jaebradley avatar jaebradley commented on July 17, 2024

Hey @uriklar, thanks for reaching out!

Have you tried actually consuming these example components in an app and can verify the css get's injected?

You can see the example components and CSS being utilized here: https://stackblitz.com/edit/example-rollup-react-component-npm-package?file=package.json

image

It'd be great to get some more background into what issues you're seeing.

from example-rollup-react-component-npm-package.

uriklar avatar uriklar commented on July 17, 2024

Hi @jaebradley. Thanks for the ultra quick response :-)
It was my mistake. I wasn't aware I need to import the css separately.

from example-rollup-react-component-npm-package.

jaebradley avatar jaebradley commented on July 17, 2024

@uriklar no worries - it's not particular clear from the README that the CSS is built / imported separately. I'm hoping to add some more documentation in the future.

Cheers!

from example-rollup-react-component-npm-package.

uriklar avatar uriklar commented on July 17, 2024

While we're here.. I was wondering if during your research you've found a good resource on building a tree shakable component library with Rollup (or even Webpack)?
I'm trying to achieve that and though i've marked "sideEffects": false it seams like my consumer app is getting the whole bundle regardless of what i'm importing.
Thanks again for the response and for the great example!

from example-rollup-react-component-npm-package.

jaebradley avatar jaebradley commented on July 17, 2024

@uriklar are you tree-shaking ES6 modules only? Or are you transpiling ES6 modules into CommonJS?

from example-rollup-react-component-npm-package.

uriklar avatar uriklar commented on July 17, 2024

The latter, transpiling to common js too

from example-rollup-react-component-npm-package.

jaebradley avatar jaebradley commented on July 17, 2024

I think you need to tell Babel not to transpile ES6 modules so you can take advantage of static analysis.

image

https://developers.google.com/web/fundamentals/performance/optimizing-javascript/tree-shaking/

I could definitely be missing the ball on something as I don't know exactly what your setup is.

from example-rollup-react-component-npm-package.

uriklar avatar uriklar commented on July 17, 2024

Thanks a lot! I'll try it out

from example-rollup-react-component-npm-package.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.