Webpack made more convenient.
Jetpack wraps webpack to create a smoother developer experience. Jetpack can be used instead of webpack, webpack-cli, webpack-dev-server and webpack-dev-middleware without writing any configuration. Jetpack is a thin wrapper around webpack, and can be extended with any webpack configuration.
- Preconfigured Babel with
@babel/preset-react, configurable via
- Preconfigured PostCSS with
postcss-preset-envincluding autoprefixing, configurable via
- Differential builds and serving with modern/legacy bundles served to browsers based on user agent headers.
- CSS modules available by switching one config flag.
- Sass support by installing
- Automatic JSX detection switches between
hdepending on dependencies.
- Hot reloading built in for React (using
- Automatic chunk splitting with inlined runtime and HTML generation.
- Smooth workflow for simultaneously developing client and server applications.
- Single dependency with hassle-free updates.
- Optionally run anywhere without installing locally, just like
Why use jetpack? To avoid rolling your own custom webpack config or having to paste it from old projects. Jetpack has a set of defaults that should get you off the ground quickly. And with the
proxy config or universal
jetpack/serve middleware you don't have to worry about wiring up webpack dev middleware or dev server – everything just works.
Install globally or locally:
$ npm install -g jetpack
In your project with
index.js, start your app on
To build the app for production to a
$ jetpack build
Inspect the bundle size and make up:
$ jetpack inspect
Print what browsers will be supported:
$ jetpack browsers $ jetpack browsers --coverage=GB
Use jetpack anywhere, anytime
$ jetpack ~/Desktop/magic.js
Or any project on your machine:
$ jetpack --dir ~/projects/manyverse
Use jetpack with an API
Another goal of jetpack is to assist you in building complete, production apps. Very often in addition to developing the clientside application, you are also developing an API. Jetpack has a few features to make building such apps easier.
package.json#main to your server entry and
package.json#browser to your client entry.
Now you can run your API server together with jetpack in a single command:
$ jetpack -x
Alternatively, specify any command to execute: $ jetpack -x 'nodemon ./api'
Use this even if your server is not written in node
$ jetpack -x 'rails s'
Jetpack provides an ability to proxy requests to your api by specifying
proxy configuration in
jetpack.config.js or mounting the dev server to your application server using the
jetpack/serve middleware. Read more about it in Workflow and deployment docs.
- All configuration options
- Customizing Webpack
- Customizing Babel
- Customizing PostCSS
- Customizing Browserslist
- Workflow and deployment
- Differential serving
- Hot reloading
- Comparison to cra, pwa-cli, parcel, etc.
- Deploying to Netlify – static apps
- Deploying to Now – client and server all in one
- Deploying to Netlify + Now – client and server separated
- Adding Flow
- Adding Typescript
- Server side rendering
This project is an exploration of some ideas accumulated over a few years using webpack in a variety of projects. Webpack is a very powerful and flexible tool. It applies to a lot of use cases and that is one of the reasons it has so many configuration options. Webpack also evolved over the years but preserved backward compatibility as much as possible to support the large ecosystem built around it.
Jetpack is an exploration of how using webpack could be made easier if the defaults, the CLI usage patterns and the configuration would be different.