Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Export schema only once #736

Merged
merged 1 commit into from
Mar 12, 2024
Merged

fix: Export schema only once #736

merged 1 commit into from
Mar 12, 2024

Conversation

inaiat
Copy link
Contributor

@inaiat inaiat commented Feb 6, 2024

We have a problem using import-in-the-middle (lib embedded inside opentelemetry), because this lib intercept and register a hook of modules. I found a issue that reexport of schema module, beceuse this module is export twice on index.js.

The exception generated using import-in-the-middle, papr, and node20:

file:///Users/papr/esm/index.js?iitm=true:90
    let $schema = $1707251817792598e86e3.schema
        ^

SyntaxError: Identifier '$schema' has already been declared
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:167:18)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:30)

Node.js v20.11.0

Thanks in advanced.

@avaly
Copy link
Collaborator

avaly commented Feb 7, 2024

Thanks @inaiat for submitting this change!

Can you please provide a minimal reproducible repo with OpenTelemetry & Papr setup?

@inaiat
Copy link
Contributor Author

inaiat commented Feb 7, 2024

Thanks @inaiat for submitting this change!

Can you please provide a minimal reproducible repo with OpenTelemetry & Papr setup?

Hello @avaly,

here is the sample: https://github.com/inaiat/papr-sample/tree/main

Thanksl

@avaly
Copy link
Collaborator

avaly commented Feb 7, 2024

Thanks for that reproducible repo!

It seems that this issue is an issue with the import-in-the-middle package. This issue seems to report the same bug like you uncovered here.

I am inclined to wait a few more days to see if this gets solved upstream. Otherwise, we can bring in this change.

@inaiat
Copy link
Contributor Author

inaiat commented Mar 6, 2024

Hey @avaly !
I guess that the issue is hard to resolve! So I think its easier apply the "fix".

Thank you!

Copy link
Collaborator

@avaly avaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's make this change!

@avaly avaly changed the title fix: Import-in-the-middle error because schema module is reexport twice fix: Export schema only once Mar 12, 2024
@avaly avaly merged commit fee69db into plexinc:main Mar 12, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants