forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.static-viz.config.js
57 lines (50 loc) · 1.29 KB
/
webpack.static-viz.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
const SRC_PATH = __dirname + "/frontend/src/metabase";
const BUILD_PATH = __dirname + "/resources/frontend_client";
const CLJS_SRC_PATH = __dirname + "/frontend/src/cljs_release";
const LIB_SRC_PATH = __dirname + "/frontend/src/metabase-lib";
const BABEL_CONFIG = {
cacheDirectory: process.env.BABEL_DISABLE_CACHE ? null : ".babel_cache",
};
module.exports = env => {
const shouldDisableMinimization = env.WEBPACK_WATCH === true;
return {
mode: "production",
context: SRC_PATH,
performance: {
hints: false,
},
entry: {
"lib-static-viz": {
import: "./static-viz/index.js",
library: {
name: "StaticViz",
type: "var",
},
},
},
output: {
path: BUILD_PATH + "/app/dist",
filename: "[name].bundle.js",
},
module: {
rules: [
{
test: /\.(tsx?|jsx?)$/,
exclude: /node_modules|cljs/,
use: [{ loader: "babel-loader", options: BABEL_CONFIG }],
},
],
},
resolve: {
extensions: [".webpack.js", ".web.js", ".js", ".jsx", ".ts", ".tsx"],
alias: {
metabase: SRC_PATH,
cljs: CLJS_SRC_PATH,
"metabase-lib": LIB_SRC_PATH,
},
},
optimization: {
minimize: !shouldDisableMinimization,
},
};
};