Boilerplate to build a React PWA with Webpack + Workbox
I have build this boilerplate following the Webpack documentation which is great.
Why another boilerplate?
The answer is simple. I wanted to go through the whole process of setting up my environment to build awesome web apps and be able to understand every single piece of a boilerplate config. That's why I decided to build my own. I'm very thankful to the new Webpack documentation which has helped me a lot.
This starter kit comes with:
.js
and .css
script for you whenever your code changes and gets compiled..js
bundle when in dev mode or load the css and put it in a separate folder when in production mode with extract-text-webpack-plugin
url-loader
to your devDependencies
you also have to add file-loader
cuz it's a peer dependencie.To get started, clone the repo and run yarn install
, or npm install
if you are using npm
. I recommend Yarn because it's fast than npm and also enables you to have a cache on your machine so you don't waste your bandwidth having to download everything whenever your run npm install
.
Get the latest snapshot, or the entire repo if you remove --depth=1
git clone --depth=1 https://github.com/oPauloChaves/es6-webpack2-starter.git project-name
cd project-name
yarn install
# or
npm install
You have to have Node (version >= 6) installed on your machine. This project depends on
webpack-dev-server
which recommends you use version 6 for the moment because there are some known issues with version 7. In my machine I have been using node v7 with no issues.
yarn start
# or
npm start
The app is available on localhost:3000
yarn run build
npm i -g serve
serve -s dist
┌────────────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:5000 │
│ - On Your Network: http://10.0.0.105:5000 │
│ │
│ Copied local address to clipboard! │
│ │
└────────────────────────────────────────────────┘
yarn run lint
# or to autofix
yarn run lint:fix
yarn run format
Pull requests are very welcome!
node-sass
and sass-loader
. I put Maybe? because I intent to use only vanilla JS and CSS in this project.