This option was enabled by default at some point in the node-resolve plugin, which should already have fixed#303 and #288. It still prints a warning though, which is illogical when we're compiling for a Node target. This silences that warning.
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>
* Update README moving .mjs with .module.js
Hi, referring to #426 in my case to get rid of the error (`Can't import the named export 'xxx' from non EcmaScript module`) I just changed the name of the output file.
I just copy-pasted from readme, so I assume a different readme didn't make me run into this error.
* typo
Co-authored-by: Leah <github.leah@hrmny.sh>