Skip to content

Commit

Permalink
Merge pull request #5 from ony3000/fix-exports
Browse files Browse the repository at this point in the history
build(core): Exports the type of CJS module
  • Loading branch information
ony3000 authored Jul 20, 2024
2 parents 3cab650 + 5fc09d3 commit 102a76c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/tailwind-joy/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
Expand All @@ -22,6 +23,17 @@ export default defineConfig({
dts({
entryRoot: 'src',
include: ['src/**'],
afterBuild(emittedFiles) {
for (const [path, code] of emittedFiles) {
const extensionReplacedPath = path.replace(/\.d\.ts$/, '.d.cts');
const extensionAddedCode = code.replace(
/(from '\.?\.(?:\/[^/;]+)*\/[^/;.]+)(';)/g,
'$1.cjs$2',
);

writeFileSync(extensionReplacedPath, extensionAddedCode);
}
},
}),
react(),
safelistGenerator(),
Expand Down

0 comments on commit 102a76c

Please sign in to comment.