-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.babel.js
71 lines (61 loc) · 1.5 KB
/
webpack.config.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin';
// see: https://github.com/webpack/webpack/issues/2537
const isProd = process.env.NODE_ENV === 'production';
export default {
context: __dirname,
mode: isProd ? 'production' : 'development',
bail: isProd,
devtool: isProd ? 'source-map' : 'cheap-module-eval-source-map',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.js'],
alias: {
src: path.resolve(__dirname, 'src'),
},
},
module: {
rules: [
{
test: /\.jsx?$/,
enforce: 'pre',
exclude: /node_modules|coverage/,
use: [
'babel-loader',
'eslint-loader',
],
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
inject: true,
}),
new FriendlyErrorsWebpackPlugin({
compilationSuccessInfo: {
messages: ['Project is running at http://localhost:8080'],
notes: ['Run linter with: yarn lint', 'Run tests with: yarn test'],
},
}),
],
devServer: {
historyApiFallback: true,
contentBase: false,
noInfo: true,
quiet: true,
// Shows a full-screen overlay in the browser when there
// are compiler errors or warnings.
overlay: {
errors: true,
},
},
};