From c0b833be6f993f1e98048f97bbef7e6a1c056246 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Thu, 20 Feb 2025 14:46:29 +1100 Subject: [PATCH] fix: update import path for SingleDatePicker and adjust Vite configuration for output filenames --- src/index.ts | 2 +- vite.config.ts | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index bef03e4..75a3e89 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ import './style.scss' -export {default as SingleDatePicker} from './components/SingleDatePicker.tsx' \ No newline at end of file +export {default as SingleDatePicker} from './components/SingleDatePicker' \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 85f0cdc..c38d9a7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,20 +8,30 @@ export default defineConfig(({mode}) => ({ lib: { entry: "src/index.ts", name: "datenel-react", - fileName: format => `datenel.${format}.js`, + fileName: format => `index.${format}.js`, }, rollupOptions: { external: ["react"], output: { globals: { react: "React", + "react-dom": "ReactDOM", }, + assetFileNames: assetInfo => { + if (assetInfo.names[0].endsWith(".css")) { + return "index.css"; + } + return `assets/${assetInfo.names[0]}`; + } }, }, }, - plugins: [react(), dts({ - tsconfigPath: "./tsconfig.app.json" - })], + plugins: [ + react(), + dts({ + tsconfigPath: "./tsconfig.app.json" + }), + ], resolve: { alias: { "@": path.resolve(__dirname, "./src"),