From 5ff0d6abbae3f98276f4460b34478e02d7ef98a2 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:15:46 -0700 Subject: [PATCH] chore: drop CJS build (#151) Co-authored-by: Alec Larson <1925840+aleclarson@users.noreply.github.com> BREAKING CHANGE --- README.md | 4 +++- package.json | 12 ++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 584df85..274803d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,9 @@ Give [`vite`] the ability to resolve imports using TypeScript's path mapping. 1. Install as dev dependency -2. Inject `vite-tsconfig-paths` using the `vite.config.ts` module +2. Ensure the project either has `"type": "module"` set or that the Vite config is renamed to `vite.config.mjs` / `vite.config.mts` depending on whether TypeScript is used + +3. Inject `vite-tsconfig-paths` in the Vite config ```ts import { defineConfig } from 'vite' diff --git a/package.json b/package.json index af105f4..32ed952 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,10 @@ "name": "vite-tsconfig-paths", "version": "4.3.2", "description": "Vite resolver for TypeScript compilerOptions.paths", - "main": "dist/index.js", - "module": "dist/index.mjs", + "type": "module", "exports": { - "import": "./dist/index.mjs", - "require": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - } + "types": "./dist/index.d.ts", + "default": "./dist/index.js" }, "author": "aleclarson", "repository": "aleclarson/vite-tsconfig-paths", @@ -18,7 +14,7 @@ "clean": "rimraf dist && git checkout HEAD dist", "dev": "yarn bundle --watch", "build": "yarn clean && yarn bundle", - "bundle": "tsup-node src/index.ts --sourcemap --dts --format cjs,esm", + "bundle": "tsup-node src/index.ts --sourcemap --dts --format esm", "prepare": "yarn build", "test": "jest" },