You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to convert a large project from Mocha + babel to Mocha + SWC, but get errors if the test file extension ends with .js and not .jsx. I have hundreds of files like this.
Renaming one of them makes SWC compile it correctly, but I really prefer keeping the tests files with the .js extension.
the project is based on React v16, so every component and its test file has the React import:
import React from 'react';
I would assume SWC would be smart enough to automatically know the content of the file is JSX...
We have a related issue after an upgrade that @swc-node/register does not parse .js files as JSX, even through we declare jsx: 'react' in our register() call. The workaround for us however is to downgrade to 1.5.5 😅
Hi, This is a clone of an issue i've opened on the main
SWC
repoIt might be better suited for this repo than the main
SWC
one.Repo - https://github.com/yairEO/swc-js-extension-fails-with-jsx-content
Describe the bug
Hi, I am trying to convert a large project from Mocha + babel to Mocha + SWC, but get errors if the test file extension ends with
.js
and not.jsx
. I have hundreds of files like this.Renaming one of them makes SWC compile it correctly, but I really prefer keeping the tests files with the
.js
extension.the project is based on React v16, so every component and its test file has the
React
import:I would assume SWC would be smart enough to automatically know the content of the file is JSX...
Input code
No response
Config
Expected behavior
Should transpile JSX for
.js
files automaticallyActual behavior
No response
Version
1.5.5
Additional context
Am using these packages:
Running the tests with this
.mocharc
:The text was updated successfully, but these errors were encountered: