You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some files in the openapi sdk import * themselves like below.
I don't know how common this is elsewhere but these files are auto-generated which might explain this strange pattern.
batches.mjs
// File generated from our OpenAPI spec by Stainless.import*asBatchesAPIfrom"./batches.mjs";exportclassBatches{}exportclassBatchesPage{}(function(Batches){Batches.BatchesPage=BatchesAPI.BatchesPage;})(Batches||(Batches={}));
If you import the above in Node, there is no error.
If the import-in-the-middle/hook.mjs is registered, you get the following error:
file:///Users/tim/Documents/Repositories/repro/more.mjs:5
Batches.BatchesPage = BatchesAPI.BatchesPage;
^
ReferenceError: Cannot access 'BatchesPage' before initialization
at file:///Users/tim/Documents/Repositories/repro/more.mjs:5:38
at file:///Users/tim/Documents/Repositories/repro/more.mjs:6:3
at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:475:24)
at async file:///Users/tim/Documents/Repositories/repro/test.mjs:5:1
The text was updated successfully, but these errors were encountered:
Another strange ESM edge case!
Some files in the
openapi
sdkimport *
themselves like below.I don't know how common this is elsewhere but these files are auto-generated which might explain this strange pattern.
batches.mjs
If you import the above in Node, there is no error.
If the
import-in-the-middle/hook.mjs
is registered, you get the following error:The text was updated successfully, but these errors were encountered: