-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
46 lines (43 loc) · 1.19 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
import { defineConfig } from "vite";
import marko from "@marko/vite";
import postcss from './postcss.config.js'
const { NODE_ENV } = process.env;
const isProd = NODE_ENV === "production";
export default defineConfig({
plugins: [
marko(),
{
apply: "build",
name: "worker-condition",
config(options) {
if (options.build.ssr && options.ssr?.target === "webworker") {
// Add the `worker` export condition to tell Marko to load worker compatible stream apis.
// Remove when https://github.com/vitejs/vite/issues/6401 is resolved.
options.resolve = {
conditions: ["worker"],
};
}
return options;
},
},
],
build: {
minify: true,
outDir: "dist", // Server and client builds should output assets to the same folder.
emptyOutDir: false, // Avoid server / client deleting files from each other.
rollupOptions: {
output: {
// Output ESM for the server build also.
// Remove when https://github.com/vitejs/vite/issues/2152 is resolved.
format: "es",
},
},
},
ssr: {
target: "webworker",
noExternal: isProd,
},
css: {
postcss,
}
});