Skip to content

Commit cbeff88

Browse files
committed
chore: use require shim
1 parent 2dbd9b6 commit cbeff88

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/core/rslib.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default defineConfig({
99
bundle: false,
1010
distPath: './dist-types',
1111
},
12+
banner: {
13+
js: `import { createRequire } from 'module';
14+
var require = createRequire(import.meta.url);\n`,
15+
},
1216
},
1317
],
1418
source: {

packages/core/src/css/cssConfig.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { createRequire } from 'node:module';
21
import path from 'node:path';
32
import type { RsbuildConfig, RsbuildPlugin } from '@rsbuild/core';
43
import { CSS_EXTENSIONS_PATTERN } from '../constant';
54
import { RemoveCssExtractAssetPlugin } from './RemoveCssExtractAssetPlugin';
65

7-
const require = createRequire(import.meta.url);
8-
96
export const RSLIB_TEMP_CSS_DIR = '__rslib_css__';
107

118
// https://rsbuild.dev/zh/config/output/css-modules#cssmodulesauto

0 commit comments

Comments
 (0)