From 24e74fe47796d523277e970969950f6119387431 Mon Sep 17 00:00:00 2001 From: Alexander Sorokin <10401817+brawaru@users.noreply.github.com> Date: Sun, 22 Oct 2023 06:30:35 +0200 Subject: [PATCH] Make Omorphia an ESM-only module ESM is widely supported these days and continues to improve. All intended Omorphia consumers do not use CJS export, as such it is unnecessary and can be safely removed to speed up the build process and remove the possibility of the dual package hazard. Third-party consumers recommended to switch to ESM or use async import. Recommended read: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c --- package.json | 4 +--- vite.config.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8195c6f45..031f2c7e4 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,11 @@ "files": [ "dist" ], - "main": "./dist/omorphia.umd.cjs", "module": "./dist/omorphia.js", "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/omorphia.js", - "require": "./dist/omorphia.cjs" + "import": "./dist/omorphia.js" }, "./dist/style.css": "./dist/style.css" }, diff --git a/vite.config.ts b/vite.config.ts index 8359a1abb..c9791c576 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ entry: resolve(__dirname, 'lib/index.ts'), name: 'Omorphia', fileName: 'omorphia', - formats: ['es', 'cjs'], + formats: ['es'], }, }, plugins: [