diff --git a/hook.js b/hook.js index 79a2e5b..5bea2b9 100644 --- a/hook.js +++ b/hook.js @@ -253,6 +253,15 @@ function createHook (meta) { return url } + // If the file is referencing itself, we need to skip adding the iitm search params + if (url.url === parentURL) { + return { + url: url.url, + shortCircuit: true, + format: url.format + } + } + specifiers.set(url.url, specifier) return { diff --git a/test/fixtures/cyclical-self.mjs b/test/fixtures/cyclical-self.mjs new file mode 100644 index 0000000..cabcb57 --- /dev/null +++ b/test/fixtures/cyclical-self.mjs @@ -0,0 +1,8 @@ +// File generated from our OpenAPI spec by Stainless. +import * as BatchesAPI from './cyclical-self.mjs' +export class Batches {} +export class BatchesPage {} +(function (Batches) { + Batches.BatchesPage = BatchesAPI.BatchesPage +// eslint-disable-next-line no-class-assign +})(Batches || (Batches = {})) diff --git a/test/hook/cyclical-self.mjs b/test/hook/cyclical-self.mjs new file mode 100644 index 0000000..4e40613 --- /dev/null +++ b/test/hook/cyclical-self.mjs @@ -0,0 +1,4 @@ +import { Batches, BatchesPage } from '../fixtures/cyclical-self.mjs' +import { strictEqual } from 'assert' + +strictEqual(Batches.BatchesPage, BatchesPage)