From 7201409d00ba87c275c4d703018ed3ce23f63aff Mon Sep 17 00:00:00 2001 From: Nathan Vasse Date: Wed, 22 Nov 2023 17:29:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8(build)=20fix=20Vite=20CJS=20config?= =?UTF-8?q?=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the migration to Vite 5 we had the "The CJS build of Vite's Node API is deprecated" error ocurring during compilation. We needed to rename to .mts the vite config file in order for it to acknowledge that we are using the Node ESM API, this is needed because we do not set "type": "module" in package.json because we need to support CJS too. --- packages/react/tsconfig.node.json | 4 +++- packages/react/{vite.config.ts => vite.config.mts} | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) rename packages/react/{vite.config.ts => vite.config.mts} (95%) diff --git a/packages/react/tsconfig.node.json b/packages/react/tsconfig.node.json index 9d31e2a..921f77e 100644 --- a/packages/react/tsconfig.node.json +++ b/packages/react/tsconfig.node.json @@ -5,5 +5,7 @@ "moduleResolution": "Node", "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts"] + "include": [ + "vite.config.mts" + ] } diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.mts similarity index 95% rename from packages/react/vite.config.ts rename to packages/react/vite.config.mts index 5df1d50..9fa3c4d 100644 --- a/packages/react/vite.config.ts +++ b/packages/react/vite.config.mts @@ -1,9 +1,8 @@ import { resolve } from "path"; -import { defineConfig } from "vitest/config"; +import { defineConfig, BuildOptions } from "vite"; import react from "@vitejs/plugin-react"; import dts from "vite-plugin-dts"; import tsconfigPaths from "vite-tsconfig-paths"; -import { BuildOptions } from "vite"; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => {