forked from instedd/active-monitoring
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
79 lines (68 loc) · 1.9 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
var path = require('path')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var CopyWebpackPlugin = require('copy-webpack-plugin')
var FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin')
module.exports = {
devServer: {
disableHostCheck: true,
host: '0.0.0.0',
port: 4001,
overlay: true
},
resolve: {
/* Load path for required files */
modules: [
path.join(__dirname, 'node_modules'),
path.join(__dirname, '_web/static/js')
],
extensions: ['.js', '.jsx']
},
/*
Entry points.
Only code referenced from this files will be included in the target bundles.
*/
entry: [
'./web/static/js/app.jsx',
'./web/static/css/app.scss'
],
output: {
path: path.join(__dirname, 'priv/static'),
filename: 'js/app.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015', 'stage-0', 'react'],
plugins: ['transform-object-rest-spread', 'transform-flow-comments']
}
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({use: 'css-loader'})
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({use: [{loader: 'css-loader'}, {loader: 'sass-loader'}]})
}
]
},
/* Include sourcemaps along generated files */
devtool: 'cheap-module-source-map',
plugins: [
/* Extract all compiled styles into a separate stylesheet instead of
requiring CSS from javascript files as Webpack does by default. */
new ExtractTextPlugin('css/app.css'),
/* Copy static assets from web/static/assets.
Note that when new messages are added we still need to restart the webpack
watch.
*/
new CopyWebpackPlugin([{ from: './web/static/assets' }]),
new FlowBabelWebpackPlugin()
]
}