-
-
Save alersenkevich/94eb5e3b851962b0ca7699703f4ff64b to your computer and use it in GitHub Desktop.
webpack.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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