/* global require, module, __dirname */ const path = require('path'); const MomentLocalesPlugin = require('moment-locales-webpack-plugin'); const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); // uncomment here and in plugins to analyze bundle size // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; module.exports = { mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', entry: './js/index.js', output: { path: path.resolve(__dirname, 'dist'), publicPath: 'dist/', filename: 'index_bundle.js' }, devtool: 'cheap-module-source-map', externals: { cheerio: 'window', 'react/addons': 'react', 'react/lib/ExecutionEnvironment': 'react', 'react/lib/ReactContext': 'react', 'react-addons-test-utils': 'react-dom', }, module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, use: [ 'babel-loader', { loader: 'eslint-loader', options: { fix: true, emitWarning: process.env.NODE_ENV === 'development' } } ] }, { test: /\.css$/, use: [ 'style-loader', { loader: 'css-loader', options: { importLoaders: 1, minimize: true } }, ] }, { test: /\.(png|jpg|gif|eot|svg|ttf|woff|woff2)$/, use: [ { loader: 'file-loader', options: { name: 'img/[name].[ext]' } } ] } ] }, plugins: [ // new BundleAnalyzerPlugin(), // uncomment to analyze bundle size new LodashModuleReplacementPlugin({ // 'chain': true, 'collections': true, 'paths': true }), new MomentLocalesPlugin() ] }