@@ -208,6 +208,26 @@ async function bundleDeclarations() {
208
208
await execa ( "shx" , [ "rm" , `${ rootDir } /dist/index.js` ] )
209
209
}
210
210
211
+ async function fixDeclarationImports ( ) {
212
+ info ( "Fixing declaration import extensions for NodeNext" )
213
+ const files = [
214
+ `${ rootDir } /dist/react/index.d.ts` ,
215
+ `${ rootDir } /dist/preact/index.d.ts` ,
216
+ `${ rootDir } /dist/solid/index.d.ts` ,
217
+ `${ rootDir } /dist/vue/index.d.ts` ,
218
+ `${ rootDir } /dist/angular/index.d.ts` ,
219
+ ]
220
+ for ( const file of files ) {
221
+ try {
222
+ let raw = await readFile ( file , "utf8" )
223
+ raw = raw . replace ( / f r o m ' \. \. \/ i n d e x ' " ? / g, "from '../index.mjs'" )
224
+ await writeFile ( file , raw )
225
+ } catch ( e ) {
226
+ error ( `Failed to postprocess ${ file } : ${ ( e as Error ) . message } ` )
227
+ }
228
+ }
229
+ }
230
+
211
231
async function addPackageJSON ( ) {
212
232
info ( "Writing package.json" )
213
233
const raw = await readFile ( resolve ( rootDir , "package.json" ) , "utf8" )
@@ -302,6 +322,7 @@ async function main() {
302
322
// await qwikBuild()
303
323
await declarationsBuild ( )
304
324
await bundleDeclarations ( )
325
+ await fixDeclarationImports ( )
305
326
await nuxtBuild ( )
306
327
await addPackageJSON ( )
307
328
await addAssets ( )
0 commit comments