From 970ca03cf782980761f128c7716690b3c90f3255 Mon Sep 17 00:00:00 2001 From: Geordan Neukum Date: Tue, 22 Jul 2025 20:57:15 -0400 Subject: [PATCH] build: publish cjs + esm Right now, we only publish ESM. Let's update our build configuration and package.json exports to support both module formats. This is useful for consumers relying on `require` to load modules. --- package.json | 7 ++++++- vite.config.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 44c84f92..56298bca 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,12 @@ "email": "kmenne@gmail.com" }, "type": "module", - "main": "dist/prettier-plugin-ember-template-tag.js", + "exports": { + ".": { + "import": "./dist/prettier-plugin-ember-template-tag.js", + "require": "./dist/prettier-plugin-ember-template-tag.cjs" + } + }, "scripts": { "build": "tsc && vite build", "example": "pnpm preexample && cd examples && pnpm example", diff --git a/vite.config.ts b/vite.config.ts index 8bba1e68..8ae5cf9e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,7 +7,7 @@ export default defineConfig({ }, lib: { entry: 'src/main.ts', - formats: ['es'], + formats: ['es', 'cjs'], }, minify: false, },