forked from wurmlab/sequenceserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
58 lines (56 loc) · 2.25 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
/* eslint-disable no-undef */
const path = require('path');
const webpack = require('webpack');
module.exports = (env, argv) => {
const pluginsPath = env.pluginsPath || './public/js/null_plugins';
return {
entry: {
search: {
import: './public/js/search.js',
filename: './sequenceserver-search.min.js',
},
report: {
import: './public/js/report_root.js',
filename: './sequenceserver-report.min.js',
}
},
output: {
path: path.join(__dirname, 'public'),
},
mode: process.env.NODE_ENV || 'development',
devServer: { contentBase: path.join(__dirname, 'public/js') },
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
}
],
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
}),
new webpack.EnvironmentPlugin({ NODE_ENV: 'development', targetEnv: env.targetEnv || 'standalone'}),
new webpack.DefinePlugin({
process: { env: {} },
})
],
resolve: {
modules: [path.resolve(__dirname, 'public', 'js'), path.resolve(__dirname, 'node_modules')],
alias: {
'report_plugins': path.resolve(__dirname, pluginsPath, 'report_plugins.js'),
'download_links': path.resolve(__dirname, pluginsPath, 'download_links.js'),
'hit_buttons': path.resolve(__dirname, pluginsPath, 'hit_buttons.js'),
'search_header_plugin': path.resolve(__dirname, pluginsPath, 'search_header_plugin.js'),
'grapher': path.resolve(__dirname, './public/js', 'grapher.js'),
'histogram': path.resolve(__dirname, pluginsPath, 'grapher', 'histogram.js'),
'query_stats': path.resolve(__dirname, pluginsPath, 'query_stats.js'),
'options': path.resolve(__dirname, pluginsPath, 'options.js'),
}
},
devtool: argv.mode === 'production' ? 'source-map' : 'cheap-source-map'
};
};