fix: use vite-plugin-symfony Stimulus loader and wrap react_component in div
The @symfony/stimulus-bundle loader generates an empty controllers.js, so Stimulus controllers from controllers.json (including ux-react) were never registered. Switching to vite-plugin-symfony/stimulus/helpers uses the virtual:symfony/controllers module that properly reads controllers.json. Also wrap react_component() output in a <div> since it only renders data-attributes, not a full HTML element. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
4
assets/bootstrap.js
vendored
4
assets/bootstrap.js
vendored
@@ -1,4 +1,4 @@
|
||||
import { startStimulusApp } from '@symfony/stimulus-bundle';
|
||||
import { startStimulusApp } from 'vite-plugin-symfony/stimulus/helpers';
|
||||
|
||||
const app = startStimulusApp();
|
||||
|
||||
@@ -15,5 +15,5 @@ window.resolveReactComponent = (name) => {
|
||||
.map(k => k.replace('./react/controllers/', '').replace('.jsx', ''));
|
||||
throw new Error(`React controller "${name}" does not exist. Possible values: ${available.join(', ')}`);
|
||||
}
|
||||
return module.default;
|
||||
return module;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"controllers": {
|
||||
"@symfony/ux-react": {
|
||||
"react": {
|
||||
"enabled": true,
|
||||
"fetch": "eager"
|
||||
}
|
||||
},
|
||||
"@symfony/ux-turbo": {
|
||||
"turbo-core": {
|
||||
"enabled": true,
|
||||
@@ -9,12 +15,6 @@
|
||||
"enabled": false,
|
||||
"fetch": "eager"
|
||||
}
|
||||
},
|
||||
"@symfony/ux-react": {
|
||||
"react": {
|
||||
"enabled": true,
|
||||
"fetch": "eager"
|
||||
}
|
||||
}
|
||||
},
|
||||
"entrypoints": []
|
||||
|
||||
Reference in New Issue
Block a user