mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
Got rid of "module" export condition everywhere. Seems like it has very poor usage everywhere.
36 lines
946 B
TypeScript
36 lines
946 B
TypeScript
import { defineConfig } from "vite";
|
|
// @ts-ignore
|
|
import { reactRouter } from "@react-router/dev/vite";
|
|
// @ts-ignore
|
|
import { dedupeMeta } from "./proxy-emulator/dedupe-meta";
|
|
import { existsSync } from "fs";
|
|
// @ts-ignore
|
|
import path from "path";
|
|
// @ts-ignore
|
|
import fg from "fast-glob";
|
|
|
|
const rootDir = ["..", "../..", "../../.."]
|
|
.map((dir) => path.join(__dirname, dir))
|
|
.find((dir) => existsSync(path.join(dir, ".git")));
|
|
|
|
const hasPrivateFolders =
|
|
fg.sync([path.join(rootDir ?? "", "packages/*/private-src/*")], {
|
|
ignore: ["**/node_modules/**"],
|
|
}).length > 0;
|
|
|
|
const conditions = hasPrivateFolders
|
|
? ["webstudio-private", "webstudio"]
|
|
: ["webstudio"];
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
conditions: [...conditions, "browser", "development|production"],
|
|
},
|
|
ssr: {
|
|
resolve: {
|
|
conditions: [...conditions, "node", "development|production"],
|
|
},
|
|
},
|
|
plugins: [reactRouter(), dedupeMeta],
|
|
});
|