aurgil-webpack-setup
v1.3.0
Published
Setup for webpack
Downloads
52
Maintainers
Readme
aurgil-webpack-setup
This package allows you to get webpack config without to re-write it your-self.
This package contains three configurations for webpack
- Production : This configuration allows you to generate a build version of your webpack application
- Development : This configuration contains necessary tools to develop with webpack (source-map, server)
- Analysis : This configuration allows you to get a page to analyze your webpack application size (by chunk)
How to install
- Go to you project repository
cd my-project
npm init -y
npm i -D aurgil-webpack-setup
How to use
- In your webpack config file (webpack.config.js), first of all, you have to get 'aurgil-webpack-setup'. Add the next line at the beginning of the file.
const WebpackSetup = require("aurgil-webpack-setup").WebpackSetup;
- You have to require the webpack-merge package to make your life easier. Add the next line after the previous.
const webpackMerge = require("webpack-merge");
- Now, you can write your webpack config and merge it with default configuration of 'aurgil-webpack-setup'.
let webpackSetup = new WebpackSetup(__dirname);
let myWebpackConfig = {entry: "./src/index.js"};
let devWebpackConfig = webpackMerge(myWebpackConfig, webpackSetup.development.config());
let prodWebpackConfig = webpackMerge(myWebpackConfig, webpackSetup.production.config() );
let anlWebpackConfig = webpackMerge(myWebpackConfig, webpackSetup.analysis.config() );
module.exports = devWebpackConfig ;
//module.exports = prodWebpackConfig;
//module.exports = anlWebpackConfig ;
- Finaly, you can start webpack with the configuration
webpack --config webpack.config.js
Default configuration
- Production configuration :
~=productionConfig=~
- Development configuration :
~=developmentConfig=~
- Analysis configuration :
~=analysisConfig=~