-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
92 lines (89 loc) · 2.94 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
80
81
82
83
84
85
86
87
88
89
90
91
92
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const path = require('path');
const fs = require('fs');
const config = [{
entry: {
'./htdocs/js/components/DynamicDataTable.js': './jsx/DynamicDataTable.js',
'./htdocs/js/components/PaginationLinks.js': './jsx/PaginationLinks.js',
'./htdocs/js/components/StaticDataTable.js': './jsx/StaticDataTable.js',
'./htdocs/js/components/MultiSelectDropdown.js': './jsx/MultiSelectDropdown.js',
'./htdocs/js/components/Breadcrumbs.js': './jsx/Breadcrumbs.js',
'./htdocs/js/components/Form.js': './jsx/Form.js',
'./htdocs/js/components/Markdown.js': './jsx/Markdown.js',
'./module/js/index.js': './module/jsx/index.js',
},
output: {
path: __dirname + '/',
filename: '[name]',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader'],
},
{
test: /\.json$/,
loader: 'json',
},
],
},
resolve: {
alias: {
util: path.resolve(__dirname, './htdocs/js/util'),
jsx: path.resolve(__dirname, './jsx'),
Breadcrumbs: path.resolve(__dirname, './jsx/Breadcrumbs'),
DataTable: path.resolve(__dirname, './jsx/DataTable'),
DynamicDataTable: path.resolve(__dirname, './jsx/DynamicDataTable'),
Filter: path.resolve(__dirname, './jsx/Filter'),
FilterableDataTable: path.resolve(__dirname, './jsx/FilterableDataTable'),
FilterForm: path.resolve(__dirname, './jsx/FilterForm'),
Form: path.resolve(__dirname, './jsx/Form'),
Loader: path.resolve(__dirname, './jsx/Loader'),
Markdown: path.resolve(__dirname, './jsx/Markdown'),
Modal: path.resolve(__dirname, './jsx/Modal'),
MultiSelectDropdown: path.resolve(__dirname, './jsx/MultiSelectDropdown'),
PaginationLinks: path.resolve(__dirname, './jsx/PaginationLinks'),
Panel: path.resolve(__dirname, './jsx/Panel'),
ProgressBar: path.resolve(__dirname, './jsx/ProgressBar'),
StaticDataTable: path.resolve(__dirname, './jsx/StaticDataTable'),
Tabs: path.resolve(__dirname, './jsx/Tabs'),
TriggerableModal: path.resolve(__dirname, './jsx/TriggerableModal'),
},
extensions: ['*', '.js', '.jsx', '.json'],
},
externals: {
react: 'React',
},
node: {
fs: 'empty',
},
devtool: 'source-map',
plugins: [],
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
uglifyOptions: {
compress: false,
ecma: 6,
mangle: false,
},
sourceMap: true,
}),
],
},
}];
// Support project overrides
if (fs.existsSync('./project/webpack-project.config.js')) {
const projConfig = require('./project/webpack-project.config.js');
config[0].entry = Object.assign(config[0].entry, projConfig);
}
module.exports = config;