From 05b6b72104206468b50743026981e9d3c4974c61 Mon Sep 17 00:00:00 2001 From: Ivan Dolgov Date: Sat, 22 Sep 2018 00:55:11 +0300 Subject: Configure initial setup --- webpack.config.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 webpack.config.js (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..99bbe49 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,36 @@ +const path = require('path'); +const webpack = require('webpack'); + +module.exports = (env, argv) => { + const commonConf = { + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + use: 'babel-loader', + }, { + test: /\.css$/, + use: ['style-loader', 'css-loader'], + }, + ], + }, + }; + + const devConf = { + devServer: { + port: 3000, + contentBase: path.resolve(__dirname, './src'), + hot: true, + stats: 'minimal', + }, + devtool: 'source-map', + plugins: [new webpack.HotModuleReplacementPlugin()], + }; + + if (argv.mode === 'development') { + return { ...commonConf, ...devConf }; + } + + return commonConf; +}; -- cgit v1.2.1