Skip to content

Commit

Permalink
Update post-build.js as esm
Browse files Browse the repository at this point in the history
  • Loading branch information
lyleaigbedion authored Dec 12, 2024
1 parent 6e987c2 commit 84efbfa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/post-build.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const fs = require('fs');
const path = require('path');
import { writeFileSync } from 'fs';
import { join } from 'path';

const cjsDir = path.join(__dirname, '..', 'dist', 'cjs');
if (!fs.existsSync(cjsDir)) {
fs.mkdirSync(cjsDir, { recursive: true });
}
const cjsDir = join(process.cwd(), 'dist', 'cjs');

fs.writeFileSync(path.join(cjsDir, 'package.json'), JSON.stringify({ type: "commonjs" }, null, 2));
const packageJsonContent = {
type: 'commonjs',
};

writeFileSync(join(cjsDir, 'package.json'), JSON.stringify(packageJsonContent, null, 2));

0 comments on commit 84efbfa

Please sign in to comment.