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

bug: cannot find module @stencil/core/internal/client #5868

Closed
3 tasks done
karthikeyan-arumugam-1558 opened this issue Jun 28, 2024 · 8 comments · Fixed by #5873
Closed
3 tasks done

bug: cannot find module @stencil/core/internal/client #5868

karthikeyan-arumugam-1558 opened this issue Jun 28, 2024 · 8 comments · Fixed by #5873
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@karthikeyan-arumugam-1558

Prerequisites

Stencil Version

4.19.0

Current Behavior

I consume our component library as a dist-custom-elements in my React project using Vite bundler. Until I used 4.18.3 of @stencil/core, I didn't face this error. Started seeing this from 4.19.0.

Expected Behavior

This error shouldn't be thrown

System Info

System: node 20.12.0
    Platform: darwin (23.5.0)
   CPU Model: Apple M2 (8 cpus)
    Compiler: /Users/xxx/Documents/Projects/yyy/node_modules/@stencil/core/compiler/stencil.js
       Build: 1719433468
     Stencil: 4.19.0 🏄
  TypeScript: 5.4.5
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

Ours is a private component library, but install any Stencil-based component library that uses @stencil/core@4.19.0, consume a component from dist-custom-elements and try to build the consuming application.

Code Reproduction URL

NA

Additional Information

FAIL  src/features/Listings/components/DownList/DownList.test.tsx
 ● Test suite failed to run

   Cannot find module '@stencil/core/internal/client' from 'node_modules/comp-lib/dist/components/ou-avatar2.js'

   Require stack:
     node_modules/comp-lib/dist/components/ou-avatar2.js
     node_modules/comp-lib/dist/components/ou-avatar.js
     node_modules/comp-lib-react/dist/src/components/stencil-generated/index.js
     node_modules/comp-lib-react/dist/src/components/index.js
     node_modules/comp-lib-react/dist/src/index.js
     src/features/Listings/components/DownList/DownList.test.tsx
@ionitron-bot ionitron-bot bot added the triage label Jun 28, 2024
@christian-bromann christian-bromann self-assigned this Jun 28, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Jun 28, 2024
@christian-bromann
Copy link
Member

@karthikeyan-arumugam-1558 any chance you can provide a minimal reproducible example?

@karthikeyan-arumugam-1558
Copy link
Author

@christian-bromann, since it's a build-time error, how would you expect the example to be?

@christian-bromann
Copy link
Member

@karthikeyan-arumugam-1558 can you maybe provide a setup that reproduces the build error? It seems like you are using a Jest context, it is important for us to know if you are using Jest as a testrunner or the Stencil testrunner which uses Jest under the hood.

@christian-bromann
Copy link
Member

@karthikeyan-arumugam-1558 I've added a commit to #5873 which adds a require export for this path. This seems very odd to me though since the file contents are meant to be consumed within a ESM context (in the browser).

@KillerCodeMonkey
Copy link
Contributor

KillerCodeMonkey commented Jul 1, 2024

sadly this error occurs in an angular + ionic project as well, when testing with jest.

those tests where failing since 4.18.2 (#5786).

With 4.19.1 i get the error of that issue:

Cannot find module '@stencil/core/internal/client' from '../../node_modules/@ionic/core/components/index.js'

Part of the require stack:

Require stack:
      /node_modules/@ionic/core/components/index.js
      /node_modules/@ionic/angular/fesm2022/ionic-angular-common.mjs
      /node_modules/@ionic/angular/fesm2022/ionic-angular-standalone.mjs

I changed nothing in the jest.config. So i have something similar to that in there, which was working before.

{
  ...
  transformIgnorePatterns: [
    'node_modules/(?!(@ionic/angular|@ionic/core|ionicons|@stencil/core|@angular/*))'
  ],
  ...
}

@christian-bromann
Copy link
Member

@KillerCodeMonkey thanks for the feedback. It appears that these fixes which we have merged and are about to release tomorrow have to be picked up by the Ionic Framework and then released. Please keep an eye on the upcoming releases, in the meantime please pin the version for @ionic/core to the one that doesn't contain this bug. I apologies for the inconvenience.

@KillerCodeMonkey
Copy link
Contributor

You do not have to apologize :). Thanks for caring and responding/fixing so fast.

github-merge-queue bot pushed a commit to ionic-team/ionic-framework that referenced this issue Jul 2, 2024
Issue number: resolves #29681

---------

### Release Notes

<details>
<summary>ionic-team/stencil (@&#8203;stencil/core)</summary>

###
[`v4.19.2`](https://togithub.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4192-2024-07-02)

[Compare
Source](https://togithub.com/ionic-team/stencil/compare/v4.19.1...v4.19.2)

### Bug Fixes

* **hydrate:** partially revert
[#5838](ionic-team/stencil#5838)
([#5876](ionic-team/stencil#5876))
([dfbc340](ionic-team/stencil@dfbc340))
* **hydrate:** support server side rendering of components with listener
([#5877](ionic-team/stencil#5877))
([2c5b7f8](ionic-team/stencil@2c5b7f8)),
fixes [#5869](ionic-team/stencil#5869)
* **testing:** add testing sub module to export map
([#5873](ionic-team/stencil#5873))
([bb2e04f](ionic-team/stencil@bb2e04f)),
fixes [#5871](ionic-team/stencil#5871) and
[#5868](ionic-team/stencil#5868)

</details>
@KillerCodeMonkey
Copy link
Contributor

@christian-bromann btw: it is working :) Thanks!

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

Successfully merging a pull request may close this issue.

3 participants