-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
87 lines (86 loc) · 1.57 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import autoprefixer from 'autoprefixer';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import precss from 'precss';
import webpack from 'webpack';
export default {
context: `${__dirname}/src`,
entry: {
bundle: `${__dirname}/src/js/main.js`
},
output: {
path: `${__dirname}/dist`,
filename: '[name].js',
publicPath: '/'
},
progress: true,
resolve: {
modulesDirectories: [
'src',
'node_modules'
],
extensions: ['', '.js', '.json', '.html']
},
eslint: {
configFile: '.eslintrc'
},
jscs: {
configFile: '.jscsrc'
},
devServer: {
hot: true,
inline: true,
progress: true,
colors: true,
contentBase: 'dist',
port: 3000
},
devtool: 'source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: `${__dirname}/src/html/index.html`,
filename: `${__dirname}/dist/index.html`
})
],
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: [
'eslint',
'jscs'
]
}
],
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
include: [
`${__dirname}/src`
],
loader: 'babel'
},
{
test: /\.scss$/,
loaders: [
'style',
'css',
'postcss',
'sass'
]
}
]
},
postcss: [
autoprefixer({
browsers: [
'IE 9',
'IE 10',
'IE 11',
'last 2 versions'
]
}), precss
]
};