Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Node 22.12 error with dist/cjs imports #54

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"getStaticDirs.d.ts"
],
"scripts": {
"build": "node scripts/rm.js dist && tsc --outDir dist/es && babel src --out-dir dist/cjs --extensions '.ts,.tsx' && node scripts/npmPackDev.js",
"build": "node scripts/rm.js dist && tsc --outDir dist/es && babel src --out-dir dist/cjs --extensions '.ts,.tsx' && node scripts/npmPackDev.js && node scripts/post-build.js",
"format": "prettier src example/src --write",
"start:example": "npm run build && cd example && npm i ../storybook-addon-code-editor-0.0.0.tgz && npm run storybook:dev",
"build:example": "npm run build && cd example && npm i ../storybook-addon-code-editor-0.0.0.tgz && npm run storybook:build",
Expand Down
10 changes: 10 additions & 0 deletions scripts/post-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { writeFileSync } from 'fs';
import { join } from 'path';

const cjsDir = join(process.cwd(), 'dist', 'cjs');

const packageJsonContent = {
type: 'commonjs',
};

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