On Windows, `tsx watch` can hang when running under `concurrently` due to stdin handling conflicts (see [privatenumber/tsx#623][]). Adding the `--raw` flag to `concurrently` avoids this by preventing stdin interception. Since `--raw` mode disables concurrently's automatic output prefixing, a custom Vite logger is added to prefix messages with `[vite]` so users can still distinguish which process produced each line of output. [privatenumber/tsx#623]: https://github.com/privatenumber/tsx/issues/623 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
31 lines
818 B
TypeScript
31 lines
818 B
TypeScript
import { createLogger, defineConfig } from "vite";
|
|
import { viteSingleFile } from "vite-plugin-singlefile";
|
|
|
|
const INPUT = process.env.INPUT;
|
|
if (!INPUT) {
|
|
throw new Error("INPUT environment variable is not set");
|
|
}
|
|
|
|
const isDevelopment = process.env.NODE_ENV === "development";
|
|
|
|
const prefixedLogger = createLogger();
|
|
for (const level of ["info", "warn", "error"] as const) {
|
|
const fn = prefixedLogger[level];
|
|
prefixedLogger[level] = (msg, opts) => fn(msg.replace(/^/mg, "[vite] "), opts);
|
|
}
|
|
|
|
export default defineConfig({
|
|
customLogger: prefixedLogger,
|
|
plugins: [viteSingleFile()],
|
|
build: {
|
|
sourcemap: isDevelopment ? "inline" : undefined,
|
|
cssMinify: !isDevelopment,
|
|
minify: !isDevelopment,
|
|
|
|
rollupOptions: {
|
|
input: INPUT,
|
|
},
|
|
outDir: "dist",
|
|
emptyOutDir: false,
|
|
},
|
|
});
|