Skip to content

Commit b79cef3

Browse files
committed
Fix Node.js 22 compatibility issue in rollup config
- Replace deprecated 'assert' syntax with readFileSync for JSON import - Node 22 deprecated 'assert' in favor of 'with' keyword for import assertions - Using readFileSync ensures compatibility across Node 20 and 22
1 parent 2aa3110 commit b79cef3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rollup.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import resolve from '@rollup/plugin-node-resolve';
22
import commonjs from '@rollup/plugin-commonjs';
33
import typescript from '@rollup/plugin-typescript';
44
import { dts } from 'rollup-plugin-dts';
5-
import pkg from './package.json' assert { type: 'json' };
5+
import { readFileSync } from 'fs';
6+
7+
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
68

79
export default [
810
// ESM and CommonJS bundles
@@ -27,7 +29,7 @@ export default [
2729
tsconfig: './tsconfig.json',
2830
declaration: true, // Ensure declarations are generated
2931
declarationDir: './dist/types', // Output declarations here
30-
rootDir: './src' // Specify root dir to maintain structure in declarationDir
32+
rootDir: './src', // Specify root dir to maintain structure in declarationDir
3133
}),
3234
],
3335
external: [],

0 commit comments

Comments
 (0)