Awesome
boilerplate-webpack-typescript
🍴 Starter with Webpack & TypeScript
Features
- ✅ Webpack
- ✅ TypeScript
- ✅ Distribution directory
dist/
- ✅ Directory with files as-is without changes
static/
(they will copied todist/static/
) - ✅ Development with
webpack-dev-server
- ✅ Hosting with
http-server
- ✅ Bundle file size analytics with
webpack-bundle-analyzer
- ✅ Two build strategies: dev (with source maps) & prod (compress file)
Getting started
You can start in two ways:
Use Git
mkdir PROJECT_NAME
cd $_ # Note: "$_" is the last argument of the previous command
git init # Note: branch "master" is created
git remote add boilerplate git@github.com:piecioshka/boilerplate-webpack-typescript.git
git pull boilerplate master
git remote remove boilerplate
or ...
Use Zip
- Download package file: https://github.com/piecioshka/boilerplate-webpack-typescript/archive/master.zip
- Extract it to your project directory.
How to build an application?
npm run build # Development mode
npm run build:development # Development mode
npm run build:production # Production mode
TIP: Serve dist/
directory by npm start
How to develop an application?
npm run dev # Use webpack-dev-server
or
npm run watch # Use webpack -w
TIP: Serve dist/
directory by npm start
Remove generated directory
npm run clear # Remove only dist/
npm run clear:all # Remove dist/ & node_modules/
🧩 Webpack Addons
When would you like a modified Webpack configuration, please add a new "addon" to webpack/addons/ directory.
- webpack.bundleAnalyzer.js - Analysis of bundle file weight
- webpack.copyStatic.js - Copy directory
static/
todist/static/
(Enabled by default)
How to run addons?
# Single addon
npm run dev -- --env addons=singleAddon
npm run build -- --env addons=singleAddon
npm run watch -- --env addons=singleAddon
npm run build:development -- --env addons=singleAddon
npm run build:production -- --env addons=singleAddon
## Multiple addons
npm run dev -- --env addons=firstAddon,secondAddon
License
The MIT License @ 2023-2024