/
webpack.config.js
62 lines (53 loc) · 1.21 KB
/
webpack.config.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
const webpack = require('webpack');
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpack = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
var BUILD_DIR = path.resolve(__dirname, 'dist/');
var APP_DIR = path.resolve(__dirname, 'src/');
const rootDir = path.resolve(__dirname);
var config = {
entry: APP_DIR + '/scripts/index.js',
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js?/,
include: APP_DIR,
loader: 'babel'
},
{
test: /\.(html|ico)$/,
loader: 'raw',
include: APP_DIR
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css!sass'),
include: APP_DIR
}
]
},
plugins: [
new CleanWebpackPlugin(['dist'], {
'root': rootDir
}),
new HtmlWebpack({
filename: 'index.html',
inject: 'body',
template: path.resolve(rootDir, 'src', 'index.html')
}),
new ExtractTextPlugin('[name].css')
],
devServer: {
contentBase: path.resolve(rootDir, 'dist'),
inline: true,
port: 9000
},
debug: true
};
module.exports = config;