Skip to content

Commit

Permalink
fix: Use @preact/signals-react-transform (#19639)
Browse files Browse the repository at this point in the history
* fix: Use @preact/signals-react-transform

This is to be able to remove usage of installAutoSignalTracking in Hilla, which will not work with React 19, as stated in preactjs/signals#576

* fix test
  • Loading branch information
Artur- authored Jun 27, 2024
1 parent 04a116f commit 0908779
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"devDependencies": {
"vite": "5.3.1",
"@vitejs/plugin-react": "4.3.1",
"@preact/signals-react-transform": "0.3.1",
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@babel/preset-react": "7.24.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export function addFunctionComponentSourceLocationBabel() {
return;
}
const filename = state.file.opts.filename;
addDebugInfo(path, name, filename, node.body.loc);
if (node.body.loc) {
addDebugInfo(path, name, filename, node.body.loc);
}
}
}
};
Expand Down
8 changes: 7 additions & 1 deletion flow-server/src/main/resources/vite.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,13 @@ export const vaadinConfig: UserConfigFn = (env) => {
presets: [['@babel/preset-react', { runtime: 'automatic', development: !productionMode }]],
// React writes the source location for where components are used, this writes for where they are defined
plugins: [
!productionMode && addFunctionComponentSourceLocationBabel()
!productionMode && addFunctionComponentSourceLocationBabel(),
[
'module:@preact/signals-react-transform',
{
mode: 'all' // Needed to include translations which do not use something.value
}
]
].filter(Boolean)
}
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void getDefaultDevDependencies_includesAllDependencies_whenUsingVite() {
expectedDependencies.add("@babel/preset-react");
expectedDependencies.add("@types/react");
expectedDependencies.add("@types/react-dom");
expectedDependencies.add("@preact/signals-react-transform");

Set<String> actualDependendencies = defaultDeps.keySet();

Expand Down

0 comments on commit 0908779

Please sign in to comment.