-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
razzle.config.js
35 lines (31 loc) · 1.17 KB
/
razzle.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
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
const fs = require("fs");
const path = require("path");
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
console.log("Using custom razzle config");
module.exports = {
modify: (config, { target, dev }, webpack) => {
console.log("Running ", dev, target);
if (target === "web" && !dev) {
config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: "static" }));
}
if (target === "web" && dev) {
config.entry = {
editor: [resolveApp("src/editor.client")],
frame: [resolveApp("src/frame.client")]
// codemirror: [resolveApp("src/utils/codemirror.assets")]
};
config.output.filename = "static/js/[name].bundle.js";
} else if (target === "web" && !dev) {
config.entry = {
editor: [resolveApp("src/editor.client")],
frame: [resolveApp("src/frame.client")]
// codemirror: [resolveApp("src/utils/codemirror.assets")]
};
config.output.filename = "static/js/[name].bundle.[chunkhash:8].js";
}
return config;
}
};