-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
80 lines (77 loc) · 2.11 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
71
72
73
74
75
76
77
78
79
80
'use strict';
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const extractLess = new ExtractTextPlugin({
filename: '[name].css'
});
const copyAssets = new CopyWebpackPlugin([{
from: 'src/client/assets/img',
to: '../img'
}]);
module.exports = {
entry: {
reactApp: ['babel-polyfill', './src/client/react/App.jsx'],
bundle: ['./src/client/js/main.js'],
registration: ['./src/client/js/registration.js'],
profile: ['./src/client/js/profile.js'],
admin: ['./src/client/js/admin.js'],
sponsoring: ['./src/client/js/sponsoring.js'],
map: ['./src/client/js/map.js'],
messages: ['./src/client/js/messages.js'],
team: ['./src/client/js/team.js'],
liveblog: ['./src/client/js/liveblog.js'],
landingpage: ['./src/client/js/landingpage.js'],
styles: ['./src/client/less/styles.less']
},
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: [ path.resolve(__dirname, 'src/client/react/'), path.resolve(__dirname, 'node_modules/breakout-api-client') ],
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
plugins:[ 'transform-object-rest-spread' ]
}
}
},
{
test: /\.(js)$/,
include: path.resolve(__dirname, 'src/client/js'),
use: {
loader: 'babel-loader',
},
},
{
test: /\.(less)$/,
include: path.resolve(__dirname, 'src/client/less/'),
use: extractLess.extract({
use: [{
loader: 'css-loader',
}, {
loader: 'postcss-loader'
}, {
loader: 'less-loader'
}]
})
}, {
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'url-loader',
options: {
limit: 10000
}
}
]
},
node: {
fs: 'empty'
},
plugins: [extractLess, copyAssets]
};