@sbovyrin/webpack-mini
v1.1.2
Published
Minimal webpack config that is easy extending when it's necessary
Downloads
1
Maintainers
Readme
webpack-mini
Read Changelog before updating!
Minimal webpack config that is easy extending when it's necessary.
By default:
- input file
index.js
must be located insrc
directory - html-template file must be located in project root
- output files are located in
dist
directory
Quick start
- Create main js file in
src
directory:/src/index.js
- Create index.html template in your project root:
/index.html
- Create
webpack.config.js
file 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
/dist
directory
- 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.js
fileconst { 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...