forked from elabftw/elabftw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.js
134 lines (133 loc) · 3.65 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
* @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: [
'./src/ts/common.ts',
'./src/ts/i18n.ts',
'./src/ts/steps-links.ts',
'./src/ts/tabs.ts',
'./src/ts/tags.ts',
'./src/ts/admin.ts',
'./src/ts/edit.ts',
'./src/ts/jsoneditor.ts',
'./src/ts/team.ts',
'./src/ts/uploads.ts',
'./src/ts/todolist.ts',
'./src/ts/ucp.ts',
'./src/ts/view.ts',
'./src/ts/comments.ts',
'./src/ts/editusers.ts',
'./src/ts/profile.ts',
'./src/ts/search.ts',
'./src/ts/show.ts',
'./src/ts/sysconfig.ts',
'./src/ts/change-pass.ts',
'bootstrap/js/src/alert.js',
'bootstrap/js/src/button.js',
'bootstrap/js/src/collapse.js',
'bootstrap/js/src/dropdown.js',
'./src/ts/fontawesome.ts',
// mathjax config must be loaded before mathjax lib
'./web/app/js/src/mathjax-config.js',
// load tex with all the extensions
'mathjax/es5/tex-svg-full.js',
'prismjs',
// see list in edit.js tinymce codesample plugin settings
'prismjs/components/prism-bash.js',
'prismjs/components/prism-c.js',
'prismjs/components/prism-cpp.js',
'prismjs/components/prism-css.js',
'prismjs/components/prism-fortran.js',
'prismjs/components/prism-go.js',
'prismjs/components/prism-java.js',
'prismjs/components/prism-javascript.js',
'prismjs/components/prism-julia.js',
'prismjs/components/prism-latex.js',
'prismjs/components/prism-makefile.js',
'prismjs/components/prism-matlab.js',
'prismjs/components/prism-perl.js',
'prismjs/components/prism-python.js',
'prismjs/components/prism-r.js',
'prismjs/components/prism-ruby.js',
],
},
// uncomment this to find where the error is coming from
// makes the build slower
//devtool: 'inline-source-map',
plugins: [
// only load the moment locales that we are interested in
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(ca|de|en|es|fr|it|id|ja|kr|nl|pl|pt|pt-br|ru|sk|sl|zh-cn)$/),
],
mode: 'production',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'web/app/js')
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
module: {
rules:[
// ts loader
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
},
},
{
test: /\.css$/i,
use: 'css-loader',
},
// transpile things with babel so javascript works with Edge
{
test: /\.m?js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
compact: false,
}
}
},
// expose jquery and moment globally
{
test: require.resolve('jquery'),
loader: 'expose-loader',
options: {
exposes: ['$', 'jQuery'],
},
},
{
test: require.resolve('moment'),
loader: 'expose-loader',
options: {
exposes: 'moment',
},
},
// use a custom loader for 3Dmol.js
{
test: /3Dmol-nojquery.js$/,
use: {
loader: path.resolve('src/ts/3Dmol-loader.js'),
},
}
]
}
};