(config, env)
| 88 | name: "fresh", |
| 89 | sharedDuringBuild: true, |
| 90 | config(config, env) { |
| 91 | isDev = env.command === "serve"; |
| 92 | |
| 93 | return { |
| 94 | server: { |
| 95 | watch: { |
| 96 | // Ignore temp files, editor swap files, and Vite timestamp |
| 97 | // files. On Linux, these short-lived files can trigger a |
| 98 | // watchFs race condition in Deno where the watcher tries to |
| 99 | // open a file that has already been deleted, crashing the |
| 100 | // dev server with ENOENT. |
| 101 | ignored: [ |
| 102 | "**/*.tmp.*", |
| 103 | "**/*.timestamp-*", |
| 104 | "**/*~", |
| 105 | "**/.#*", |
| 106 | "**/*.swp", |
| 107 | "**/*.swo", |
| 108 | ], |
| 109 | }, |
| 110 | }, |
| 111 | esbuild: { |
| 112 | jsx: "automatic", |
| 113 | jsxImportSource: "preact", |
| 114 | jsxDev: env.command === "serve", |
| 115 | }, |
| 116 | resolve: { |
| 117 | alias: { |
| 118 | "react-dom/test-utils": "preact/test-utils", |
| 119 | "react-dom": "preact/compat", |
| 120 | react: "preact/compat", |
| 121 | }, |
| 122 | // Disallow externals, because it leads to duplicate |
| 123 | // modules with `preact` vs `npm:preact@*` in the server |
| 124 | // environment. |
| 125 | noExternal: true, |
| 126 | }, |
| 127 | optimizeDeps: { |
| 128 | // Optimize deps somehow leads to duplicate modules or them |
| 129 | // being placed in the wrong chunks... |
| 130 | noDiscovery: true, |
| 131 | }, |
| 132 | |
| 133 | publicDir: pathWithRoot(fConfig.staticDir[0], config.root), |
| 134 | |
| 135 | builder: { |
| 136 | async buildApp(builder) { |
| 137 | // Build client env first |
| 138 | const clientEnv = builder.environments.client; |
| 139 | if (clientEnv !== undefined) { |
| 140 | await builder.build(clientEnv); |
| 141 | } |
| 142 | |
| 143 | await Promise.all( |
| 144 | Object.values(builder.environments).filter((env) => |
| 145 | env !== clientEnv |
| 146 | ).map((env) => builder.build(env)), |
| 147 | ); |
nothing calls this directly
no test coverage detected