forked from blcham/record-manager-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
56 lines (54 loc) · 2.02 KB
/
vite.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
/// <reference types="vitest" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dotenv from "dotenv";
import eslintPlugin from "vite-plugin-eslint";
dotenv.config();
export default defineConfig({
base: "",
root: "",
envPrefix: "RECORD_MANAGER_",
plugins: [
react(),
eslintPlugin({
cache: false,
}),
],
build: {
sourcemap: true,
emptyOutDir: true,
rollupOptions: {
onwarn: (warning, defaultHandler) => {
// TODO: workaround for dangerous use of eval method that should be solved in SForms library issue https://github.com/kbss-cvut/s-forms/issues/283
const isFromKbssCvutPackageWarning =
warning.code === "EVAL" && warning.message.includes("node_modules/store/plugins/lib/json2.js");
// TODO: Rollup Pure Annotation warning should be resolved by https://github.com/kbss-cvut/s-forms/issues/282
const isRollupPureAnnotationWarning =
warning.code === "INVALID_ANNOTATION" && warning.message.includes("*#__PURE__*");
if (isFromKbssCvutPackageWarning || isRollupPureAnnotationWarning) {
return;
}
defaultHandler(warning);
},
},
cssMinify: false, // TODO: workaround for CSS syntax error from SForms library that should be resolved by https://github.com/kbss-cvut/s-forms/issues/283
},
define: {
"process.env": process.env, // workaround for parse-link-header library that depends on 2 vars defined in `process.env`, see https://github.com/thlorenz/parse-link-header/issues/31
},
resolve: {
alias: {
querystring: "querystring-es3", // workaround for parse-link-header library that replaces nodejs builtin module with the module adapted for browser
url: "url-parse", // workaround for parse-link-header library that replaces nodejs builtin module with the module adapted for browser
},
},
test: {
environment: "jsdom",
setupFiles: ["./tests/setup.js"],
server: {
deps: {
inline: ["@kbss-cvut/s-forms"],
},
},
},
});