-
Notifications
You must be signed in to change notification settings - Fork 11
/
webpack.config.js
66 lines (60 loc) · 1.51 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
'use strict'
import webpack from 'webpack'
import path from 'path'
let inProduction = process.env.NODE_ENV === 'production' || process.argv.indexOf('-p') !== -1
export default {
entry: {
main: ['./src/script/main'],
admin: ['./src/script/admin'],
popout: ['./src/script/popout'],
livestream: ['./src/script/livestream']
},
output: {
path: __dirname,
filename: './build/script/[name].js',
chunkFilename: './build/script/[id].js'
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: [
['@babel/preset-env', {
targets: {
browsers: ['last 2 versions']
}
}]
]
}
},
{ test: /\.coffee$/, loader: 'coffee-loader', exclude: /node_modules/ },
{ test: /\.mustache$/, loader: 'mustache-loader', exclude: /node_modules/ }
],
noParse: [
/node_modules\/hls\.js/
]
},
resolve: {
extensions: ['.coffee', '.js', '.json', '.mustache'],
modules: [path.join(__dirname, '/src/script'), 'node_modules'],
alias: {
'underscore': 'lodash'
}
},
plugins: [
new webpack.ProvidePlugin({
// Detect and inject
$: 'jquery',
Backbone: 'backbone',
_: 'underscore',
Marionette: 'backbone.marionette',
Radio: 'backbone.radio'
})
],
devtool: 'inline-source-map',
mode: inProduction ? 'production' : 'development',
target: 'web'
}