Giter VIP home page Giter VIP logo

rollup-native-modules-boilerplate's Introduction

Rollup Native Modules Boilerplate

A demo app showcasing the use of real JavaScript modules in production—complete with cross-browser fallbacks for legacy browsers.

The techniques used in this demo are described in the article Using Native JavaScript Modules in Production Today.

🚀  View the demo on Glitch  👉

Features

To show that this technique can work for most types of applications, this demo is a React app and includes advanced features like:

  • Babel transforms (including JSX)
  • CommonJS dependencies (e.g. react, react-dom)
  • CSS dependencies
  • Asset hashing
  • Code splitting
  • Dynamic import (w/ polyfill fallback)
  • module/nomodule fallback

To see how all these features are configured, view the Rollup config file (rollup.config.js). To see the generated output, view the public directory after building the app (see below).

Building and running the app locally

To run the app locally, clone this repo and npm install all dependencies, then run the following command:

npm start

This will start a local server at http://localhost:3000, where you can view the app.

If you want to run the app and have Rollup monitor the code for changes (and rebundle), you can run:

npm run watch

To build the app without starting the development server, run:

npm run build

development vs production mode

By default the app is started in development mode, which means the bundle output is unminified, and a nomodule bundle is not generated. You can change this by prefixing any of the above commands with NODE_ENV=production, for example:

NODE_ENV=production npm start

rollup-native-modules-boilerplate's People

Contributors

philipwalton avatar sokra avatar

Stargazers

 avatar

Watchers

 avatar

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.