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>
34 lines
681 B
JavaScript
34 lines
681 B
JavaScript
import { defineConfig } from 'vite';
|
|
import symfonyPlugin from 'vite-plugin-symfony';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
symfonyPlugin({
|
|
stimulus: true,
|
|
}),
|
|
],
|
|
esbuild: {
|
|
jsx: 'automatic',
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
app: './assets/app.js',
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
strictPort: true,
|
|
origin: 'http://localhost:5173',
|
|
cors: true,
|
|
allowedHosts: ['node'],
|
|
hmr: {
|
|
host: 'localhost',
|
|
port: 5173,
|
|
protocol: 'ws',
|
|
},
|
|
},
|
|
});
|