Overview:
The Rollup Native Modules Boilerplate is a demo app that showcases the use of real JavaScript modules in production. It includes cross-browser fallbacks for legacy browsers and demonstrates techniques described in the article “Using Native JavaScript Modules in Production Today.”
Features:
- Babel transforms, including JSX
- CommonJS dependencies, such as react and react-dom
- CSS dependencies
- Asset hashing
- Code splitting
- Dynamic import with polyfill fallback
- Module/nomodule fallback
Installation:
- Clone the repository.
- Run
npm installto install all dependencies. - To start a local server at http://localhost:3000, use the following command:
npm start
- If you want Rollup to monitor the code for changes and rebundle, use:
npm run dev
- To build the app without starting the development server, use:
npm run build
- By default, the app is started in development mode. To switch to production mode with minified output and a nomodule bundle, prefix any of the above commands with
NODE_ENV=production.
Summary:
The Rollup Native Modules Boilerplate is an example of using real JavaScript modules in a production environment. It includes various features like Babel transforms, CommonJS dependencies, and code splitting. The installation process is straightforward, and the app can be run locally with the provided commands.