-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvite.config.ts
37 lines (35 loc) · 1.18 KB
/
vite.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
29
30
31
32
33
34
35
36
37
/*---------------------------------------------------------------------------------------------
* Copyright (c) Ian Lucas. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { reactRouter } from "@react-router/dev/vite";
import { readFileSync } from "fs";
import { resolve } from "path";
import { minify_sync } from "terser";
import ts from "typescript";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
server: {
port: 3000
},
plugins: [!process.env.VITEST && reactRouter(), tsconfigPaths()],
define: {
__SPLASH_SCRIPT__: JSON.stringify(
minify_sync(
ts.transpileModule(
readFileSync(resolve(process.cwd(), "app/utils/splash.ts"), {
encoding: "utf-8"
}),
{
compilerOptions: {
module: ts.ModuleKind.CommonJS,
noImplicitUseStrict: true,
target: ts.ScriptTarget.ES2022
}
}
).outputText
).code
)
}
});