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

Web example fails to minify with Webpack unless dependencies are explicitly transpiled #1444

Closed
bradfrosty opened this issue Aug 18, 2020 · 2 comments
Labels
Discussion Issue or PR that needs/is extended discussion.

Comments

@bradfrosty
Copy link
Contributor

What version of OpenTelemetry are you using?

0.10.2

What version of Node are you using?

12.14.1

What did you do?

While attempting to setup the web example, I was unable to run a production (minified) build.

The error while building I retrieved was the following:

    >  const context_base_1 = __webpack_require__(5910);
    >  ^
    >  ERROR: Unexpected token: keyword «const»
    >      at JS_Parse_Error.get (eval at

I am not using the @opentelemetry/context-zone package or setting a contextManager on the provider.
I am bundling with Webpack 4, using Babel as the transpilation tool.

What did you expect to see?

I expected the build to complete.

What did you see instead?

It seems that published packages are not transpiling to ES5. We currently still support older browsers, so we need to have builds that transpile to ES5. It is common to ignore node_modules when transpiling. I expected the published npm packages to have transpiled code so that I don't need to explicitly transpile the @opentelemetry dependencies in the webpack configuration.

@bradfrosty bradfrosty added the bug Something isn't working label Aug 18, 2020
@dyladan
Copy link
Member

dyladan commented Aug 21, 2020

Some of our packages are compiled down to es5 (api, semantic conventions, and context-base I believe) in order to support modules that want to depend on the opentelemetry API, but the SDK requires browser and node APIs that are newer and it wouldn't work on such an old target anyways.

Targeting es5 for SDK components may also change behavior in subtle ways. See an example of that here #593 (comment)

See also an older related issue: #902

I am removing the bug label as this is not a bug, but a request to support older browsers and legacy systems.

@dyladan dyladan added Discussion Issue or PR that needs/is extended discussion. and removed bug Something isn't working labels Aug 21, 2020
@bradfrosty
Copy link
Contributor Author

@dyladan sorry for the late response here. Thanks for the detailed answer, makes sense to me.

Do you expect significant behavior change from transpiling the dependencies? Should I be concerned if I transpile the deps from the application side?

pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this issue Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Issue or PR that needs/is extended discussion.
Projects
None yet
Development

No branches or pull requests

2 participants