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

require calls in esm build of @opentelemetry/resources #4642

Open
madimp opened this issue Apr 17, 2024 · 1 comment
Open

require calls in esm build of @opentelemetry/resources #4642

madimp opened this issue Apr 17, 2024 · 1 comment
Labels
bug Something isn't working pkg:resources priority:p1 Bugs which cause problems in end-user applications such as crashes, data inconsistencies, etc

Comments

@madimp
Copy link

madimp commented Apr 17, 2024

What happened?

Steps to Reproduce

index.ts

import { Resource } from '@opentelemetry/resources';

new Resource()

Run
./node_modules/.bin/vite-node index.ts

Expected Result

No Syntax Error

Actual Result

Syntax Error

Additional Details

There should be no require calls for the esm
https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-resources/src/platform/node/machine-id/getMachineId.ts

OpenTelemetry Setup Code

No response

package.json

{
  "name": "esmbug",
  "type": "module",
  "dependencies": {
    "@opentelemetry/resources": "^1.23.0",
    "vite-node": "^1.5.0"
  }
}

Relevant log output

esmbug/node_modules/@opentelemetry/resources/build/esm/platform/node/machine-id/getMachineId-darwin.js:52
import { execAsync } from './execAsync';
^^^^^^

SyntaxError: Cannot use import statement outside a module
@madimp madimp added bug Something isn't working triage labels Apr 17, 2024
@pichlermarc pichlermarc added priority:p1 Bugs which cause problems in end-user applications such as crashes, data inconsistencies, etc pkg:resources and removed triage labels Apr 17, 2024
@luxaritas
Copy link

FYI, this has already had some discussion in #3989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:resources priority:p1 Bugs which cause problems in end-user applications such as crashes, data inconsistencies, etc
Projects
None yet
Development

No branches or pull requests

3 participants