• Stars
    star
    1,313
  • Rank 35,829 (Top 0.8 %)
  • Language
    JavaScript
  • Created over 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚀 Jetpack – Webpack made more convenient.

jetpack

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.

  • Sensible defaults to handle modern JavaScript, CSS and images.
  • Preconfigured swc-loader for speedy compilation.
  • Preconfigured core-js for polyfilling missing browser features.
  • Preconfigured postcss-loader with postcss-preset-env including autoprefixing.
  • Modern bundles by default with no async/await transpilation.
  • Differential builds with modern/legacy bundles served based on user agent headers.
  • CSS modules one config flag away.
  • Sass auto enabled by installing node-sass.
  • JSX detection with React.createElement or h depending on dependencies.
  • Hot reloading using fast-refresh for React as well as for vanilla JavaScript and CSS.
  • Automatic chunk splitting with inlined runtime and HTML generation.
  • Single dependency with hassle-free updates.

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 the universal jetpack/serve middleware you don't have to worry about wiring up webpack dev middleware or dev server – everything just works.

Usage

Install globally or locally:

$ npm install -g jetpack

In your project with package.json or index.js, start your app on http://localhost:3030:

$ jetpack

To build the app for production to a dist directory:

$ 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

One of jetpack goals is to help you run any piece of JavaScript in a browser as easily as it is to run node scripts. Install jetpack globally and point it to any file on your machine. This is an alternative to jsfiddle / codepen / codesandbox style of hacking on things.

$ jetpack ~/Desktop/magic.js

Or any project on your machine:

$ jetpack --dir ~/projects/manyverse

Use jetpack with a server 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.

Point your 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.

Documentation

Recipes

Motivation

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.

More Repositories

1

tiny-atom

Pragmatic state management.
JavaScript
116
star
2

healthier

🧘‍♀️ Healthier is an opinionated style agnostic code linter – a friendly companion to Prettier
JavaScript
84
star
3

location-bar

A microlib for managing browser's location bar via pushState and hashChange APIs. This lib makes it easy to listen to URL changes and update the URL.
JavaScript
74
star
4

space-router

Framework agnostic router for single page apps
JavaScript
39
star
5

eslint-config-healthier

🧘‍♀️ Healthier is an opinionated style agnostic code linter – a friendly companion to Prettier
JavaScript
26
star
6

moonwave

🌗 A small web application framework.
JavaScript
14
star
7

grunt-bower-clean

Remove files (e.g. docs, tests, etc.) from installed bower components
JavaScript
10
star
8

PolyChrome

PolyChrome is a Firefox extension that can run Standard ML programs embedded in HTML documents
JavaScript
9
star
9

cherrytree-for-react

Seamlessly use cherrytree router with React
JavaScript
6
star
10

electronic-post-message

A postMessage polyfill for electron webview
JavaScript
6
star
11

kinfolk

Atoms and selectors for React
JavaScript
6
star
12

not-so-fast

Fast and efficient in-memory rate-limit, used to alleviate most common DOS attacks.
JavaScript
5
star
13

leap

An extension to Backbone that provides a solid foundation for JavaScript web applications
JavaScript
5
star
14

rave-load-jsx

Adds jsx loading to RaveJS based on file extensions.
JavaScript
4
star
15

vscode-healthier

VSCode extension to integrate healthier linter into VSCode
TypeScript
3
star
16

cherrytree-redux-react-example

A copy of emmenko/redux-react-router-async-example where react-router is replaced with cherrytree
JavaScript
3
star
17

leap-model

A lightweight alternative to Backbone.Model with support for nested attributes.
JavaScript
3
star
18

logcatislog

console log a cat
JavaScript
2
star
19

navstack.js

DEVELOPER PREVIEW
JavaScript
2
star
20

standard5

JavaScript Standard Style, but for es5 browser environments.
JavaScript
2
star
21

requirejs-examples

JavaScript
1
star
22

jetpack-serve

Jetpack's standalone middleware for serving jetpack bundles in express
JavaScript
1
star
23

kn-release

tag, push, and publish to npm and bower
JavaScript
1
star
24

rave-node-process

Adds a window.process object that shims some of node's global.process functionality
JavaScript
1
star
25

karma-webpack-grep

karma start --grep some/pattern
JavaScript
1
star
26

deploy

Tweaked combo of tj/deploy and mafintosh/taco-nginx
Shell
1
star
27

ff_async_bug

1
star
28

bro-size

Estimate the size of a package by browserifying it, uglifying and gzipping.
JavaScript
1
star
29

polychrome-scripts

1
star
30

mapsmaps

1
star