Skip to content

Commit

Permalink
fix: add CommonJS distribution for jest consumers (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation committed Dec 4, 2023
1 parent 3351cd3 commit 7fddd42
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default defineConfig((config) =>
lib: {
// Include all directories containing an index.ts
entry: globIndexMap(packageRoot),
formats: ['es'],
formats: ['es', 'cjs'],
},
minify: false,
outDir: outDir.pathname,
Expand Down
2 changes: 1 addition & 1 deletion src/react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineConfig((config) =>
],
build: {
lib: {
formats: ['es'],
formats: ['es', 'cjs'],
},
minify: false,
outDir: outDir.pathname,
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export function packageJsonTemplate(
Object.assign(current, {
[`./${next[0].replace(/\/index$/, '')}`]: {
types: `./${next[0]}.d.ts`,
esm: `./${next[0]}.js`,
import: `./${next[0]}.js`,
require: `./${next[0]}.cjs`,
default: `./${next[0]}.js`,
},
}),
Expand Down

0 comments on commit 7fddd42

Please sign in to comment.