-
Notifications
You must be signed in to change notification settings - Fork 0
/
razzle.config.js
56 lines (48 loc) · 1.31 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const path = require("path");
const LoadableWebpackPlugin = require("@loadable/webpack-plugin");
const WebpackConfigHelpers = require("razzle-dev-utils/WebpackConfigHelpers");
const Helpers = new WebpackConfigHelpers(process.cwd());
module.exports = {
plugins: ["babel-ts"],
options: {
verbose: true,
enableReactRefresh: true,
},
modifyPaths(opts) {
const { paths } = opts;
paths.appServerIndexJs = path.join(paths.appPath, "src/ssr");
paths.appClientIndexJs = path.join(paths.appPath, "src/client");
return paths;
},
modifyWebpackConfig(opts) {
const config = opts.webpackConfig;
config.module.rules[
config.module.rules.findIndex(Helpers.makeLoaderFinder("file-loader"))
].exclude.push(/\.(svg)$/);
config.module.rules.push({
test: /\.svg$/i,
use: [
{
loader: "@svgr/webpack",
options: {
icon: true,
},
},
],
});
if (opts.env.target === "web") {
const filename = path.resolve(__dirname, "build");
config.plugins.push(
new LoadableWebpackPlugin({
outputAsset: false,
writeToDisk: { filename },
})
);
config.performance = {
maxEntrypointSize: 512000,
maxAssetSize: 512000,
};
}
return config;
},
};