Skip to content

Commit b413945

Browse files
committed
fix: edge case in requiresAsImports where import is renamed
1 parent 5781822 commit b413945

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app-config-schema/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,18 @@ const r4 =
336336

337337
function requiresAsImports(text: string) {
338338
const withImports = text
339-
.replace(r4, `import * as $7Exports from $4; const { $8 } = $7Exports.$7;`)
339+
// const format0 = require('ajv-formats').formats.uri
340+
// import { formats } from 'ajv-formats';
341+
// const { uri: format0 } = formats;
342+
.replace(r4, `import { $7 } from $4; const { $8: $2 } = $7;`)
343+
// const { formats } = require('ajv-formats');
344+
// import { formats } from 'ajv-formats';
340345
.replace(r3, `import { $3 } from $5;`)
346+
// const f = require('ajv-formats').formats;
347+
// import { formats as f } from 'ajv-formats';
341348
.replace(r2, `import { $7 as $2 } from $4;`)
349+
// const formats = require('ajv-formats');
350+
// import formats from 'ajv-formats';
342351
.replace(r1, `import $2 from $4;`);
343352

344353
const importReg = /import .+;/gm;

0 commit comments

Comments
 (0)