From 0736eb22b9d94f63c7fbb2466881f73137153474 Mon Sep 17 00:00:00 2001 From: Douglas Mendes Date: Fri, 1 Mar 2024 14:45:17 -0300 Subject: [PATCH] Remove .js from file extension cjs --- package.json | 2 +- vite.config.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c407b1b..97b8e01 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "phase", "julian" ], - "main": "dist/index.cjs.js", + "main": "dist/index.cjs", "module": "dist/index.es.js", "types": "dist/index.d.ts", "type": "module", diff --git a/vite.config.ts b/vite.config.ts index d296c61..9e204c8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,7 +11,10 @@ export default defineConfig({ entry: path.resolve(__dirname, "src/index.ts"), name: "lunarphase", formats: ["es", "cjs", "umd", "iife"], - fileName: (format) => `index.${format}.js`, + fileName: (format) => { + const fileName = `index.${format}`; + return format === "cjs" ? fileName : `${fileName}.js`; + }, }, rollupOptions: { external: [],