rollup.js
Modern JavaScript bundler for efficient code packaging
À propos de rollup.js
Rollup.js is a powerful module bundler that compiles small pieces of code into larger, optimized files for web and Node.js environments. It supports multiple output formats including ES modules, CommonJS, UMD, and SystemJS, making it versatile for various platforms.
FAQ
ES modules are an official standard and the clear path forward for JavaScript code structure, whereas CommonJS modules are an idiosyncratic legacy format. ES modules allow static analysis that helps with optimizations like tree-shaking and scope-hoisting, and provide advanced features like circular references and live bindings.
Tree-shaking is Rollup's process of eliminating code that is not actually used in a given project. It is a form of dead code elimination that can be much more efficient than other approaches with regard to output size. The name is derived from the abstract syntax tree of the modules.
Rollup does not include support for CommonJS modules or Node's module location resolution logic by default. You need to install the commonjs and node-resolve plugins and enable them using a rollup.config.js file. If the modules import JSON files, you will also need the json plugin.
There are two primary reasons: philosophically, Rollup is a polyfill for native module loaders in both Node and browsers, and practically, keeping Rollup lean makes it easier to develop and maintain. Node's resolution algorithm is not needed in a browser context, and separating concerns helps keep the core large but focused.
By default, imports of dependencies of entry chunks are added as empty imports to the entry chunks themselves to speed up loading and parsing. This optimization avoids a waterfall of loading and parsing steps. You can turn it off via the output.hoistTransitiveImports option if not desired.
To ensure polyfills are executed first, you can add an import of the polyfill as the first statement to each static entry point. If there are external dependencies that depend on the polyfill, making the polyfill a separate entry or manual chunk will ensure it is executed first.
Rollup is already used by many major JavaScript libraries and can also be used to build the vast majority of applications. However, if you want to use code-splitting or dynamic imports with older browsers, you will need an additional runtime like the SystemJS Production Build.
Alternatives à considérer
Voir toutes les alternativesBadges
Faites la promotion de rollup.js et donnez-lui plus de visibilité en ajoutant ces badges à votre site web, votre documentation ou votre fiche produit. Chaque badge renvoie vers la page de rollup.js sur Webfolio.
<a href="https://www.webfolio.to/tools/rollup-js?utm_source=badge&utm_campaign=badge" target="_blank" rel="noopener noreferrer"><img src="https://www.webfolio.to/badges/featured_color.svg" alt="Mis en avant sur Webfolio" style="max-width: 150px" /></a>
Catégories
Revendiquer cet outil
Vous êtes le fondateur ? Revendiquez votre profil pour mettre à jour les détails et suivre les vues.