Closed zthng closed 1 month ago
Hmm, that's odd, are you using any special babel rules/transforms? https://github.com/preactjs/signals/blob/main/packages/react-transform/src/index.ts#L545-L550 all it looks for is an element/fragment
As you only mention .tsx
, does it work correctly on .js
/.jsx
?
If so, the problem is likely an ordering problem, and you've told your TS Babel plugin to transpile JSX. You'll need to persist the JSX for this plugin.
Can you provide order of babel plugins in your config?
Hey guys, thanks for the response! Darned timezones...
Here's my babel.config.json
:
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
["@babel/preset-react", { "runtime": "automatic" }],
"@babel/preset-typescript"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
"@babel/plugin-transform-class-properties",
"module:@preact/signals-react-transform",
"babel-plugin-styled-components"
]
}
@rschristian - you're right, it's working perfectly fine for .js
and .jsx
files, only .tsx
files affected.
Doing this in TSConfig allowed the components to be found:
{
"compilerOptions": {
"jsx": "preserve",
// ...otherCompilerOptions
},
// ...otherOptions
}
Hello, the babel transform modules seems to evaluate all of my
.tsx
files ashasJSX: false
for some reason. Is there anywhere I should check with my configuration?Example of
SomeComponent.tsx
:To add more information: I'm using babel + webpack to transpile a project with a mixture of JS/JSX/TS/TSX files
Currently using
/** @useSignals */
to manually force the transformation, but would be great to better understand what's going on - not sure where to start.