Commit 6012f39
Merge #571
571: Support import JSX from JS file r=ForsakenHarmony a=n3tr
## Changes
- Support import JSX from JS file by adding JSX extension to `@rollup/plugin-node-resolve` plugin
## Background
I have experience an error when importing `.jsx file` from `.js` file like
```
index.js -> A.jsx
```
will cause an error
```
Could not resolve './A' from src/index.js
```
However, Importing `.jsx` file from TypeScript file (`.ts`) file is seems working fine except the the import is chaining more than 3 levels depth.
```sh
index.ts -> A.jsx # This is fine
index.ts -> A.jsx -> B.jsx # This is fine
index.ts -> A.jsx -> B.jsx -> C.jsx
# Error: Could not resolve './C' from src/jsx-components/B.jsx
```
To reproduce the issue
```sh
git clone -b import-jsx-error --single-branch git@github.com:n3tr/microbundle-example.git
cd microbundle-example
yarn
yarn build --jsx React.createElement ./src/index.js
# or
yarn build --jsx React.createElement ./src/index.ts
```
---
I'm not really sure what is the root cause of the error, by adding extensions seems to fix the problem.
Co-authored-by: Jirat Ki <saakyz@gmail.com>1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| 530 | + | |
| 531 | + | |
530 | 532 | | |
531 | 533 | | |
532 | 534 | | |
| |||
0 commit comments