Skip to content

Commit 83c20a4

Browse files
authored
chore(build): avoid using require in configuration file (#1288)
1 parent 911639c commit 83c20a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/rslib.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from 'node:fs';
22
import path from 'node:path';
33
import { pluginPublint } from 'rsbuild-plugin-publint';
44
import { defineConfig, type rsbuild, rspack } from 'rslib';
5+
import packageJson from './package.json' with { type: 'json' };
56

67
const pluginFixDtsTypes: rsbuild.RsbuildPlugin = {
78
name: 'fix-dts-types',
@@ -45,7 +46,7 @@ export default defineConfig({
4546
entryModuleLoader: './src/plugins/entryModuleLoader.ts',
4647
},
4748
define: {
48-
RSLIB_VERSION: JSON.stringify(require('./package.json').version),
49+
RSLIB_VERSION: JSON.stringify(packageJson.version),
4950
},
5051
},
5152
// externalize pre-bundled dependencies

0 commit comments

Comments
 (0)