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

Broken import in dist/types/components.d.ts #6

Closed
thccorni opened this issue Mar 24, 2021 · 7 comments
Closed

Broken import in dist/types/components.d.ts #6

thccorni opened this issue Mar 24, 2021 · 7 comments

Comments

@thccorni
Copy link

It seems that with v2.2.0 the dist bundle broke.

I'm getting the following error:

[ ERROR ]  TypeScript: ./node_modules/stencil-apexcharts/dist/types/components.d.ts:8:139
           Cannot find module './components/apex-chart' or its corresponding type declarations.

      L7:  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
      L8:  ackType, ApexChartToolbar, ApexChartType, ApexChartWidth, ApexOptionsSeries } from "./components/apex-chart";
      L9:  import { ApexOptions } from "apexcharts";

The folder components does not exist bellow ./node_modules/stencil-apexcharts/dist/types.

@mikaelkaron
Copy link
Collaborator

I’ll take a look at this today. Thanks for reporting @thccorni !

@mikaelkaron
Copy link
Collaborator

Ok. Have you installed the peer dependency apexcharts in your project?

@thccorni
Copy link
Author

thccorni commented Apr 1, 2021

Yes, I've installed "apexcharts": "3.26.0".

@newtonmunene99
Copy link

Any fix for this? I'm running into the same issue

@mikaelkaron
Copy link
Collaborator

So I've dug around a bit and found the source of the error (the exported types from the component don't resolve correctly in components.d.ts). That problem is not so hard to fix (basically use the global ApexChart types dirrectly), but that causes another problem, since the tag name is apex-chart stencil will create an interface named ApexChart that collides.

I'm trying to see if there's a typescript solution, but worst case scenario I'll just rename apex-chart to something else.. any good ideas?

@mikaelkaron
Copy link
Collaborator

So there's an easier option, qualifying the clashing namespace with globalThis.

Btw, this was actually a combination of two stencil "problems":

  • exporting/importing from a file in the same folder breaks components.d.ts imports (alternate fix is putting your include files in /src)
  • Clashing generated component class name with globalThis (fix is qualifying the clash. ie: globalThis.ApexChart)

@mikaelkaron
Copy link
Collaborator

mikaelkaron commented Apr 20, 2021

fixed in v2.3.0

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

No branches or pull requests

3 participants