forked from mytardis/mytardis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-webpack.config.js
133 lines (130 loc) · 5.21 KB
/
test-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
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
/* eslint-env node */
/* eslint camelcase: [2, {properties: "never"}] */
const path = require("path");
const webpack = require("webpack");
const BundleTracker = require("webpack-bundle-tracker");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const glob = require("glob");
module.exports = {
context: __dirname,
entry: {
main: "./assets/js/index.js",
tardis_portal: glob.sync("./assets/js/tardis_portal/*.js"),
tardis_portal_add_or_edit_dataset: glob.sync("./assets/js/tardis_portal/add_or_edit_dataset/*.js"),
tardis_portal_create_experiment: glob.sync("./assets/js/tardis_portal/create_experiment/*.js"),
tardis_portal_push_to: glob.sync("./assets/js/tardis_portal/push-to.js"),
tardis_portal_view_experiment_init: glob.sync("./assets/js/tardis_portal/view_experiment/init/init.js"),
tardis_portal_view_experiment_share: glob.sync("./assets/js/tardis_portal/view_experiment/share/share.js"),
tardis_portal_view_experiment: glob.sync("./assets/js/tardis_portal/view_experiment/*.js"),
tardis_portal_view_dataset: glob.sync("./assets/js/tardis_portal/view_dataset/**/*.js"),
tardis_portal_manage_group_members: glob.sync("./assets/js/tardis_portal/manage_group_members/**/*.js"),
tardis_portal_index: glob.sync("./assets/js/tardis_portal/index/**/*.js"),
tardis_portal_my_data: glob.sync("./assets/js/tardis_portal/my_data/**/*.js"),
tardis_portal_shared: glob.sync("./assets/js/tardis_portal/shared/**/*.js"),
tardis_portal_public_data: glob.sync("./assets/js/tardis_portal/public_data/**/*.js"),
tardis_portal_facility_view: "./assets/js/tardis_portal/facility_view/index.js",
tardis_portal_auth_methods: "./assets/js/tardis_portal/auth_methods/auth_methods.js",
lib: glob.sync("./assets/js/lib/**/*.js"),
push_to_app: "./assets/js/apps/push_to/index.js",
search_app : "./assets/js/apps/search/index.jsx",
test: glob.sync("./js_tests/tardis_portal/**/*.js"),
tree_view : "./assets/js/apps/tree_view/index.jsx",
index_page_badges: "./assets/js/apps/badges/components/IndexPageBadges.jsx",
public_access_badge: "./assets/js/apps/badges/components/ShareTabBadge.jsx",
experiment_view_badges: "./assets/js/apps/badges/components/ExperimentViewPageBadges.jsx",
dataset_view_badges: "./assets/js/apps/badges/components/DatasetViewPageBadges.jsx",
dataset_tiles: "./assets/js/apps/tiles/index.jsx",
choose_rights: "./assets/js/apps/choose_rights/index.jsx"
},
output: {
path: path.resolve("./assets/bundles/"),
filename: "[name].js"
},
optimization: {
minimizer: [
new TerserPlugin({
exclude: "tardis_portal_facility_view"
})],
splitChunks: {
minSize: 30000,
maxAsyncRequests: 5,
maxInitialRequests: 3
}
},
plugins: [
new BundleTracker({
path: __dirname,
filename: "webpack-stats.json",
}),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ["assets/bundles/*"]
}),
new MiniCssExtractPlugin({
filename: "[name].styles.css",
})
],
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}, {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader"
}, {
test: /\.css$/,
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: "/bundles/"
}
}, "css-loader"]
}, {
test: /\.(woff(2)?)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [{
loader: "url-loader",
options: {
limit: 10000,
mimetype: "application/font-woff",
name: "[name].[ext]",
publicPath: "/static/bundles/"
}
}]
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader",
options: {
name: "[name].[ext]",
publicPath: "/static/bundles/"
}
}, {
test: /\.(gif|png|jpe?g)$/i,
loader: "url-loader",
options: {
name: "[name].[ext]",
}
}, {
test: /\.less$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "less-loader"
}]
},
]
},
resolve: {
modules: ["node_modules"],
extensions: ["*", ".js", ".jsx"],
alias: {
"jquery": __dirname + "/node_modules/jquery"
},
}
};