2022-09-08 00:30:04 -06:00
|
|
|
'use strict';
|
|
|
|
|
2023-04-24 22:50:53 -06:00
|
|
|
const vite = require('vite');
|
|
|
|
const mergeOptions = require('merge-options');
|
|
|
|
|
|
|
|
// Require the config before the Vite config so `process.env.NODE_ENV` is set
|
|
|
|
require('../server/lib/config');
|
|
|
|
|
2022-09-08 00:30:04 -06:00
|
|
|
const writeVersionFiles = require('./write-version-files');
|
2023-04-24 22:50:53 -06:00
|
|
|
const viteConfig = require('./vite.config');
|
|
|
|
|
|
|
|
async function buildClient(extraConfig = {}) {
|
|
|
|
await writeVersionFiles();
|
2022-09-08 00:30:04 -06:00
|
|
|
|
2023-04-24 22:50:53 -06:00
|
|
|
const resultantViteConfig = mergeOptions(viteConfig, extraConfig);
|
|
|
|
await vite.build(resultantViteConfig);
|
2022-09-08 00:30:04 -06:00
|
|
|
}
|
|
|
|
|
2023-04-24 22:50:53 -06:00
|
|
|
module.exports = buildClient;
|