Skip to content

bug: Rollup Fails to Process .cts Files After Latest StencilJS Update #6198

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
kurtinatlanta opened this issue Mar 12, 2025 · 4 comments · Fixed by #6199
Closed
3 tasks done

bug: Rollup Fails to Process .cts Files After Latest StencilJS Update #6198

kurtinatlanta opened this issue Mar 12, 2025 · 4 comments · Fixed by #6199
Assignees

Comments

@kurtinatlanta
Copy link

Prerequisites

Stencil Version

4.28.0

Current Behavior

After updating to the latest StencilJS version, which includes an upgrade to the latest Rollup version, Rollup no longer processes .cts files correctly. This issue affects importing functions from libphonenumber-js. The same configuration worked fine in previous StencilJS versions.

This is the debug output:
Rollup: Parse Error: ../../../node_modules/libphonenumber-js/index.d.cts:42:20
RollupError: ../../../node_modules/libphonenumber-js/index.d.cts (42:20): Expected ',', got ':' (Note that
you need plugins to import files that are not JavaScript)
at getRollupError .../node_modules/@stencil/core/compiler/stencil.js:211989:39
at ParseError2.initialise .../node_modules/@stencil/core/compiler/stencil.js:227004:29
at convertNode2 .../node_modules/@stencil/core/compiler/stencil.js:215372:8
at convertProgram2 .../node_modules/@stencil/core/compiler/stencil.js:215358:10
at _Module.setSource .../node_modules/@stencil/core/compiler/stencil.js:229401:22
at async ModuleLoader.addModuleSource .../node_modules/@stencil/core/compiler/stencil.js:231346:11

Expected Behavior

The build succeeds.

System Info

Steps to Reproduce

  • Update StencilJS to the latest version, which includes the Rollup upgrade.
  • Use a project with a component .tsx file that imports functions from libphonenumber-js.
  • Run the StencilJS build process.
  • Observe that Rollup fails to process .cts files, causing the build to break.

Code Reproduction URL

https://www.google.com

Additional Information

This issue may be the same as #6193 and may have the same solution.

@jtcanfieldhpe
Copy link

jtcanfieldhpe commented Mar 12, 2025

+1, had similar issues for .d.mts, had to back down to 4.27.2
was missing @rollup/rollup-darwin-arm64, resolved this by adding it to my dev packages, then had:

Rollup: Parse Error: node_modules/i18next-browser-languagedetector/index.d.mts:5:7
node_modules/i18next-browser-languagedetector/index.d.mts (5:7): Expected '{', got 'type' (Note that you
need plugins to import files that are not JavaScript)

thank you! @johnjenkins

@christian-bromann christian-bromann self-assigned this Mar 12, 2025
@johnjenkins
Copy link
Contributor

@jtcanfieldhpe those issues have been fixed / merged already :)

Just teething problems dealing with a major rollup upgrade (2 > 4) ... it used to ignore a package's exports and now ... it doesn't - so we have to tweak stencil to cope with these new file types.

Will get to the CTS issue soon.

@christian-bromann
Copy link
Member

Will get to the CTS issue soon.

@johnjenkins working on a PR

@christian-bromann
Copy link
Member

@johnjenkins wdyt? #6199

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 a pull request may close this issue.

4 participants