Skip to content

bug: Static Initialization Blocks Not Executing with Higher ECMAScript Versions in StencilJS #5360

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

Closed
3 tasks done
a7medm7med opened this issue Feb 14, 2024 · 8 comments
Closed
3 tasks done
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@a7medm7med
Copy link

Prerequisites

Stencil Version

4.12.2

Current Behavior

Static initialization blocks fail to execute when the target option in the tsconfig file is set to a higher ECMAScript version than ES2017.

Expected Behavior

Static initialization blocks should execute successfully, regardless of the ECMAScript version specified in the tsconfig file.

System Info

System: node 18.19.0
    Platform: windows (10.0.22631)
   CPU Model: 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz (12 cpus)
    Compiler: D:\Work\Projects\web-components\node_modules\.pnpm\@[email protected]\node_modules\@stencil\core\compiler\stencil.js
       Build: 1707755243
     Stencil: 4.12.2
  TypeScript: 5.3.3
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.27.0

Steps to Reproduce

  • Create a StencilJS project.
  • Configure the tsconfig file to use an ECMAScript version higher than ES2017 in the target option.
  • Implement a class with static initialization blocks.
  • Compile and run the StencilJS project.

Code Reproduction URL

https://github.com/a7medm7med/stencil-static-bug

Additional Information

This issue significantly hinders developers from adopting modern ECMAScript features while working with StencilJS, thus impeding the progression of JavaScript development practices. Any insights, workarounds, or resolutions to address this issue would be greatly appreciated.

@ionitron-bot ionitron-bot bot added the triage label Feb 14, 2024
@christian-bromann christian-bromann self-assigned this Feb 14, 2024
@christian-bromann
Copy link
Member

@a7medm7med thanks for raising the issue. I can confirm that setting ES2022 as target fails while ES2021 compiles fine. The JavaScript feature in question here are static initialization blocks implemented in src/controllers/localize.ts.

I've ingested this into our backlog for the team to take a look at.

@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Feb 14, 2024
@christian-bromann christian-bromann removed their assignment Feb 14, 2024
@alicewriteswrongs
Copy link
Contributor

It looks like this is a Rollup-related issue, since support for static initialization blocks was added in 2.59.0 but we're on 2.56.3

@a7medm7med
Copy link
Author

Consider upgrading the Rollup version to at least 2.68.0 for improved performance and compatibility.

@rwaskiewicz
Copy link
Contributor

Hey @a7medm7med 👋

We will be upgrading our version of rollup later this year. Due to some cross-dependency limitations/breaking changes in rollup plugins that Stencil exposes, we're targeting this for the Stencil v5 release later this year.

@a7medm7med
Copy link
Author

@rwaskiewicz

Thanks for the update on the rollup upgrade and the Stencil v5 release. I appreciate your efforts in keeping us informed. Out of curiosity, do you know if StencilJS will be considering the adoption of Rollup version 3 in the upcoming releases as well? Looking forward to hearing more about the developments. Thanks again to you and the team for your hard work! 🚀👍

@rwaskiewicz
Copy link
Contributor

Thanks!

do you know if StencilJS will be considering the adoption of Rollup version 3 in the upcoming releases as well

Yes, we're planning on moving to the latest version of rollup (v4.x as of this writing)

@johnjenkins
Copy link
Contributor

Hey!
I think this should be fixed by #6187
Please let me know if you still experience any issues after it's released :)

@christian-bromann
Copy link
Member

A fixed was published in https://github.com/stenciljs/core/releases/tag/v4.28.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

5 participants