rollup.js
Modern JavaScript bundler for efficient code packaging
Acerca 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.
Preguntas frecuentes
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.
Alternativas a considerar
Ver todas las alternativasInsignias
Promociona rollup.js y dale más visibilidad añadiendo estas insignias a tu web, documentación o ficha de producto. Cada insignia enlaza a la página de rollup.js en 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="Destacado en Webfolio" style="max-width: 150px" /></a>
Categorías
Reclamar esta herramienta
¿Eres el fundador? Reclama tu perfil para actualizar los detalles y rastrear visualizaciones.