File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ import fs from 'node:fs' ;
2+ import path from 'node:path' ;
3+ import type { RsbuildPlugin } from '@rsbuild/core' ;
14import { defineConfig } from 'rslib' ;
25
6+ const pluginFixDtsTypes : RsbuildPlugin = {
7+ name : 'fix-dts-types' ,
8+ setup ( api ) {
9+ api . onAfterBuild ( ( ) => {
10+ const typesDir = path . join ( process . cwd ( ) , 'dist-types' ) ;
11+ const pkgPath = path . join ( typesDir , 'package.json' ) ;
12+ if ( ! fs . existsSync ( typesDir ) ) {
13+ fs . mkdirSync ( typesDir ) ;
14+ }
15+ fs . writeFileSync (
16+ pkgPath ,
17+ JSON . stringify ( {
18+ '//' : 'This file is for making TypeScript work with moduleResolution node16+.' ,
19+ version : '1.0.0' ,
20+ } ) ,
21+ 'utf8' ,
22+ ) ;
23+ } ) ;
24+ } ,
25+ } ;
26+
327export default defineConfig ( {
428 lib : [
529 {
@@ -11,6 +35,7 @@ export default defineConfig({
1135 } ,
1236 } ,
1337 ] ,
38+ plugins : [ pluginFixDtsTypes ] ,
1439 source : {
1540 entry : {
1641 index : './src/index.ts' ,
You can’t perform that action at this time.
0 commit comments