forked from elabftw/elabftw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.js
69 lines (68 loc) · 1.83 KB
/
builder.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
/**
* builder.js
*
* @author Nicolas CARPi <[email protected]>
* @copyright 2012 Nicolas CARPi
* @see https://www.elabftw.net Official website
* @license AGPL-3.0
* @package elabftw
*
* Config file for webpack
*
* This is in fact webpack.config.js but I renamed it builder.js
* because I don't want any path clash with the web folder when
* doing autocompletion.
*/
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
main: [
'jquery',
'jquery-ui',
'bootstrap/js/src/alert.js',
'bootstrap/js/src/button.js',
'bootstrap/js/src/collapse.js',
'bootstrap/js/src/dropdown.js',
'./web/app/js/src/fontawesome.es.js'
],
tinymce: [
'tinymce'
],
moment: [
'moment'
]
},
plugins: [
// only load the moment locales that we are interested in
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(ca|de|en|es|fr|it|pl|pt|pt-br|ru|sk|sl|zh-cn)$/)
],
resolve: {
alias: {
'jquery-ui': 'jquery-ui-dist/jquery-ui.js'
}
},
mode: 'production',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'web/app/js')
},
module: {
rules:[
// expose jquery and moment globally
{
test: require.resolve('jquery'),
use: [
{ loader: 'expose-loader', options: 'jQuery' },
{ loader: 'expose-loader', options: '$' }
]
},
{
test: require.resolve('moment'),
use: [
{ loader: 'expose-loader', options: 'moment' }
]
}
]
}
};