Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Stencil Version
4.26.0
Current Behavior
The @stencil/core
package does not have a @stencil/core/jsx-runtime
export path (or similar jsx-runtime
path), making it not possible to use with TypeScript's jsxImportSource
option.
Expected Behavior
Updated Stencil to work with newer TypeScript.
System Info
n/a
Steps to Reproduce
In any TypeScript project (doesn't matter if it is a React project, etc), try to put this at the top of a .tsx
file to tell TypeScript to load JSX types for any JSX
expressions from @stencil/core
:
/* @jsxImportSource @stencil/core */
You'll get an error like
Cannot find module '@stencil/core/jsx-runtime' or its corresponding type declarations.
where /jsx-runtime
is the conventional postfix that TypeScript appends to the path.
Code Reproduction URL
no URL yet
Additional Information
Without this feature, it is not possible to write Stencil components inside any other application that uses non-stencil JSX types.
The purpose of jsxImportSource
is to allow for different files to use different JSX types. This makes it possible to, for example, compile certain files with one flavor of JSX (f.e. Solid.js JSX) and other files with Stencil JSX.
Solution
The fix is likely easy: just create an empty jsx-runtime.js
file at the root of the package, along with a jsx-runtime.d.ts
file at the root of the package that re-exports the JSX
type.