Skip to content

Instantly share code, notes, and snippets.

@alersenkevich
Created December 11, 2018 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alersenkevich/94eb5e3b851962b0ca7699703f4ff64b to your computer and use it in GitHub Desktop.
Save alersenkevich/94eb5e3b851962b0ca7699703f4ff64b to your computer and use it in GitHub Desktop.
webpack.config.js
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, '../public'),
filename: 'bundle.js',
},
devtool: 'source-map',
resolve: {
modules: ['node_modules', path.resolve('src')],
extensions: ['.js', '.jsx', '.json'],
},
module: {
rules: [
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: [/node_modules/, /additional_modules/],
use: ['eslint-loader'],
},
{
test: /\.jsx?$/,
exclude: [/node_modules/, /additional_modules/],
use: {
loader: 'babel-loader',
},
},
],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
uglifyOptions: {
compress: false,
ecma: 6,
mangle: true,
},
sourceMap: true,
}),
],
},
devServer: {
contentBase: path.join(__dirname, '../public'),
historyApiFallback: true,
compress: true,
hot: true,
port: 3000,
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment