README
webpack-mini
Read Changelog before updating!
Minimal webpack config that is easy extending when it's necessary.
By default:
- input file
index.jsmust be located insrcdirectory - html-template file must be located in project root
- output files are located in
distdirectory
Quick start
- Create main js file in
srcdirectory:/src/index.js - Create index.html template in your project root:
/index.html - Create
webpack.config.jsfile in your project root- add next code to the file:
const { defaultConfig } = require('@sbovyrin/webpack-mini'); module.exports = defaultConfig();
- add next code to the file:
- Optionally install webpack-dev-server:
npm i --save-dev webpack-dev-server - Start development server:
npx webpack --watch --env.dev- or:
npx webpack-dev-server --env.dev
- or:
- Build the project for production:
npx webpack --env.prod- output files are located in
/distdirectory
- output files are located in
Features
- Ready to work out of the box
- Easy to customize
- Output separate files
- app.js (your application)
- vendor.js (app's dependencies)
- runtime.js (wepback runtime)
- styles.css (app's CSS)
- Production files are optimized (including tree-shaking)
- Hot server reload for development
- Lightweight and low resource consumer
Customize
Change entry configuration
- Create
webpack.config.jsfileconst { defaultConfig } = require('@sbovyrin/webpack-mini'); module.exports = defaultConfig(); - Create your customized config function
// here 'env' has value passed to --env (i.e '--env.prod' in script command) function customizeConfig(env) { return { entry: 'mysource/app.js' } } module.exports = defaultConfig(customizeConfig); - Now your entry point is
mysource/app.js
Using React.js
Comming soon...