Do we need live reload feature in bunders? Couldn’t we just use this extension for Visual Studio Code or simular features and extensions in other IDEs which will execute a custom command of your choice when you save a file with a certain file extension in your IDE?

https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave

This extensions allows you to customize the commands to execute in saving a file in your global VSCode settings and in the VSCode workspace settings .vscode/settings.json, allowing others to use the same configuration in group projects.

Lightning CSS does not have a live reload feature and the live reload feature in Rollup cannot handle watching many files, however using this extension in VSCode, will not watch files but run the npm run dev:css or npm run dev:js command when saving a css or js file without watching for files to change.

One downside I see with this is when working on a project with others who are using different IDEs that do not support this feature. Besides that, is there any downsides to this approach?

  • @trymeout@lemmy.worldOP
    link
    fedilink
    English
    22 months ago

    Why could a build take 5 minutes? Is it due to the size of your project or the language the bundler is written in (JavaScript being a slower option over Rust)?

    • Max-P
      link
      fedilink
      42 months ago

      The scale of things. Large projects take longer to compile and bundle because they’re made out of thousands of files and hundreds of thousands of lines of code.

      Yeah, your hello program will go just as fast without a bundler, or a simple bundler. It’s when you go big, and use tons of libraries and stuff that it slows down and the advantages become clearer.

      That’s especially true when using big libraries like React and dozens of plugins for it, frameworks like Next.js, SASS for CSS or CSS in JS, all the JSX, all the TypeScript. It adds up especially if Babel is also involved to transpile for older browser support.

      5 minutes is a bit of an extreme use case, but the point is after the first build, live reload would still refresh your code at the same speed. So working on one page you don’t need to constantly rebuild the other hundreds of them, just the one you changed. If you target mobile platforms with Cordova or React Native then you also add a whole Android/iOS build + install + restart of the app. The same live reload would work even in that context, making the speed advantage even more apparent.

      These things are designed for large enterprise projects, not for your small helloworld sized hobbyist programs.