Giter Site home page Giter Site logo

Required node version about loadcss HOT 5 CLOSED

eps1lon avatar eps1lon commented on July 29, 2024
Required node version

from loadcss.

Comments (5)

scottjehl avatar scottjehl commented on July 29, 2024

Hi! Thanks for the feedback. I am totally open to setting the node version to current if that works for dependencies here. As it is, the current recommended workflow is a snippet in the readme file anyway! :)

Any reason I shouldn't set it to latest (14 looks like)? Thanks

from loadcss.

eps1lon avatar eps1lon commented on July 29, 2024

Any reason I shouldn't set it to latest (14 looks like)? Thanks

As I understood node release cycle 14 is only meant for libraries to test integration not for apps in production. So if you set it to 14 most apps won't be able to install it. 13 is meant for library integration. 14 is meant for production.

12 would be the active lts. 10 is still maintained though and since this code is meant to work in the browser you probably don't rely on any features in node 11 or 12.

We used it for lazy loading CSS of 3rd party libraries for certain components. It was quite handy since the user of the component didn't need to make sure they setup dependencies which can lead to dead CSS if the component is removed but not the dependencies e.g.

export default function AppSearch() {
  React.useEffect(() => {
    const styleNode = loadCSS(
      'https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css',
      document.querySelector('#app-search'),
    );

    return () => {
      styleNode.parentElement.removeChild(styleNode);
    };
  }, []);
}

As it is, the current recommended workflow is a snippet in the readme file anyway! :)

Sure but this change is a good example why having this as a dependency is preferred. I never looked into the best way of lazy loading css and trusted that you did. By inlining it, it's now more code that can become outdated.

from loadcss.

scottjehl avatar scottjehl commented on July 29, 2024

from loadcss.

maxp-hover avatar maxp-hover commented on July 29, 2024

Hey, just to give my personal anecdote of how I came across this thread -

Deploying a new Rails 6 app to Heroku, the default Node version is only 10.15. However this library (which I use) requires 11, so now I need to do a complicated dance to get my app properly deployed.

I would request that we please change it back to Node 10 dependency, it is better to make it continue work on older Node versions

from loadcss.

eps1lon avatar eps1lon commented on July 29, 2024

Node 10 has reached its end-of-life so this issue is no longer relevant.

from loadcss.

Related Issues (20)

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.