-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
70 lines (67 loc) · 1.92 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
63
64
65
66
67
68
69
70
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const BUILD_DIR = path.resolve(__dirname, 'src/client/public/dist');
const APP_DIR = path.resolve(__dirname, 'src/client/app');
const HTML_TEMPLATE = path.resolve(__dirname, 'src/client/public/html/index.html');
const IMAGES_PATH = path.resolve(__dirname, 'src/client/public/images');
const config = {
entry:{
app: [
APP_DIR + '/index.jsx'
]
},
output: {
path: BUILD_DIR,
filename: 'bundle.[hash].js',
publicPath: '/'
},
module : {
rules : [
{
test : /\.jsx?/,
include : APP_DIR,
use : 'babel-loader'
},
{
test: /\.(woff|woff2)$/,
use: 'file-loader?name=fonts/[name].[ext]'
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?sourceMap', 'sass-loader?sourceMap']
})
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader'
}
]
}
]
},
resolve: {
extensions: ['.js', '.jsx']
},
plugins: [
new HtmlWebpackPlugin({
template: HTML_TEMPLATE
}),
new ExtractTextPlugin("[name].css"),
new FaviconsWebpackPlugin({
logo: IMAGES_PATH + "/trustbot.jpg",
icons: {
favicons: true,
firefox: true
}
})
],
devtool: 'source-map'
};
module.exports = config;