-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
28 lines (23 loc) · 928 Bytes
/
config.ts
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
import {createConfig, RaguServerBaseConfigProps} from "ragu-server";
import {VueComponentResolver} from "./component-resolver";
import {merge} from "webpack-merge";
import {raguVueWebpackHydrateConfig, raguVueWebpackViewConfig} from "./webpack";
export const createVueRaguServerConfig = (requiredConfig: RaguServerBaseConfigProps) => {
const config = createConfig(requiredConfig);
if (!requiredConfig?.components?.resolver) {
config.components.resolver = new VueComponentResolver(config);
}
if (!requiredConfig?.compiler?.webpack?.clientSide) {
config.compiler.webpack.clientSide = merge(
config.compiler.webpack.clientSide,
raguVueWebpackHydrateConfig(config)
);
}
if (!requiredConfig?.compiler?.webpack?.serverSide) {
config.compiler.webpack.serverSide = merge(
config.compiler.webpack.serverSide,
raguVueWebpackViewConfig(config)
);
}
return config;
}