From 27a2462435ff2002440c0c88703ec35be00bc209 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 18 Mar 2024 14:31:38 +0800 Subject: [PATCH] fix: update mjs Signed-off-by: Innei --- tsconfig.json | 2 -- vite.config.ts => vite.config.mts | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) rename vite.config.ts => vite.config.mts (88%) diff --git a/tsconfig.json b/tsconfig.json index 91c87be..f7a13b7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -35,8 +35,6 @@ "node_modules/*", "lib/*", "example/*", - "vitest.config.ts", - "vite.config.ts", "tailwind.config.ts", "demo/*" ] diff --git a/vite.config.ts b/vite.config.mts similarity index 88% rename from vite.config.ts rename to vite.config.mts index 4181168..dc0da0f 100644 --- a/vite.config.ts +++ b/vite.config.mts @@ -1,5 +1,6 @@ import { readFileSync, writeFileSync } from 'fs' import { resolve } from 'path' +import { fileURLToPath } from 'url' import react from '@vitejs/plugin-react' import { preserveDirectives } from 'rollup-plugin-preserve-directives' import { defineConfig } from 'vite' @@ -9,15 +10,19 @@ const packageJson = JSON.parse( readFileSync('./package.json', { encoding: 'utf-8' }), ) +const __dirname = fileURLToPath(new URL('.', import.meta.url)) + const globals = { // @ts-ignore ...(packageJson?.dependencies || {}), } +// eslint-disable-next-line import/no-default-export export default defineConfig({ plugins: [ react(), dts({ // rollupTypes: true + insertTypesEntry: true, beforeWriteFile: (filePath, content) => { writeFileSync(filePath.replace('.d.ts', '.d.mts'), content)