Skip to content

Commit 970ca03

Browse files
committed
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.
1 parent db2a77f commit 970ca03

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
"email": "[email protected]"
2828
},
2929
"type": "module",
30-
"main": "dist/prettier-plugin-ember-template-tag.js",
30+
"exports": {
31+
".": {
32+
"import": "./dist/prettier-plugin-ember-template-tag.js",
33+
"require": "./dist/prettier-plugin-ember-template-tag.cjs"
34+
}
35+
},
3136
"scripts": {
3237
"build": "tsc && vite build",
3338
"example": "pnpm preexample && cd examples && pnpm example",

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineConfig({
77
},
88
lib: {
99
entry: 'src/main.ts',
10-
formats: ['es'],
10+
formats: ['es', 'cjs'],
1111
},
1212
minify: false,
1313
},

0 commit comments

Comments
 (0)