From b6f2c9ef99595cfabb9cbe093c1c367e3683f077 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Fri, 18 Sep 2026 16:49:59 +0200 Subject: [PATCH] [UXVue][UXReact] Add Symfony Reprise support (#1546) --- .../3.4/assets/react/controllers/Hello.jsx | 5 ++ symfony/ux-react/3.4/manifest.json | 58 +++++++++++++++++++ symfony/ux-react/3.4/post-install.txt | 28 +++++++++ .../3.4/assets/vue/controllers/Hello.vue | 9 +++ symfony/ux-vue/3.4/manifest.json | 58 +++++++++++++++++++ symfony/ux-vue/3.4/post-install.txt | 28 +++++++++ 6 files changed, 186 insertions(+) create mode 100644 symfony/ux-react/3.4/assets/react/controllers/Hello.jsx create mode 100644 symfony/ux-react/3.4/manifest.json create mode 100644 symfony/ux-react/3.4/post-install.txt create mode 100644 symfony/ux-vue/3.4/assets/vue/controllers/Hello.vue create mode 100644 symfony/ux-vue/3.4/manifest.json create mode 100644 symfony/ux-vue/3.4/post-install.txt diff --git a/symfony/ux-react/3.4/assets/react/controllers/Hello.jsx b/symfony/ux-react/3.4/assets/react/controllers/Hello.jsx new file mode 100644 index 00000000..54fe3686 --- /dev/null +++ b/symfony/ux-react/3.4/assets/react/controllers/Hello.jsx @@ -0,0 +1,5 @@ +import React from 'react'; + +export default function (props) { + return
Hello {props.fullName}
; +} diff --git a/symfony/ux-react/3.4/manifest.json b/symfony/ux-react/3.4/manifest.json new file mode 100644 index 00000000..dd5eaff7 --- /dev/null +++ b/symfony/ux-react/3.4/manifest.json @@ -0,0 +1,58 @@ +{ + "bundles": { + "Symfony\\UX\\React\\ReactBundle": ["all"] + }, + "copy-from-recipe": { + "assets/": "assets/" + }, + "conflict": { + "symfony/webpack-encore-bundle": "<2.0", + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" + }, + "add-lines": [ + { + "file": "webpack.config.js", + "content": [ + "", + " .enableReactPreset()" + ], + "position": "after_target", + "target": ".splitEntryChunks()" + }, + { + "file": "assets/app.js", + "content": [ + "import { registerReactControllerComponents } from '@symfony/ux-react';" + ], + "position": "top", + "warn_if_missing": true + }, + { + "file": "assets/app.js", + "content": [ + "registerReactControllerComponents(require.context('./react/controllers', true, /\\.(j|t)sx?$/));" + ], + "position": "bottom", + "warn_if_missing": true, + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/app.js", + "content": [ + "registerReactControllerComponents(import.meta.glob('./react/controllers/**/*.{jsx,tsx}', { eager: true }));" + ], + "position": "bottom", + "warn_if_missing": true, + "requires": "symfony/reprise" + }, + { + "file": "assets/app.js", + "content": [ + "registerReactControllerComponents();" + ], + "position": "bottom", + "warn_if_missing": true, + "requires": "symfony/asset-mapper" + } + ] +} diff --git a/symfony/ux-react/3.4/post-install.txt b/symfony/ux-react/3.4/post-install.txt new file mode 100644 index 00000000..af55da17 --- /dev/null +++ b/symfony/ux-react/3.4/post-install.txt @@ -0,0 +1,28 @@ + + * Using Vite? Install @vitejs/plugin-react so Vite can compile JSX, + and register it in your vite.config: + + npm install --save-dev @vitejs/plugin-react + + import react from '@vitejs/plugin-react' + + export default defineConfig({ + plugins: [ + react(), + Symfony({ /* ... */ }), + ], + }) + + * Using Rsbuild? Install @rsbuild/plugin-react and register it in your + rsbuild.config: + + npm install --save-dev @rsbuild/plugin-react + + import { pluginReact } from '@rsbuild/plugin-react' + + export default defineConfig({ + plugins: [ + pluginReact(), + Symfony({ /* ... */ }), + ], + }) diff --git a/symfony/ux-vue/3.4/assets/vue/controllers/Hello.vue b/symfony/ux-vue/3.4/assets/vue/controllers/Hello.vue new file mode 100644 index 00000000..2812aa43 --- /dev/null +++ b/symfony/ux-vue/3.4/assets/vue/controllers/Hello.vue @@ -0,0 +1,9 @@ + + + diff --git a/symfony/ux-vue/3.4/manifest.json b/symfony/ux-vue/3.4/manifest.json new file mode 100644 index 00000000..ee0734b3 --- /dev/null +++ b/symfony/ux-vue/3.4/manifest.json @@ -0,0 +1,58 @@ +{ + "bundles": { + "Symfony\\UX\\Vue\\VueBundle": ["all"] + }, + "copy-from-recipe": { + "assets/": "assets/" + }, + "conflict": { + "symfony/webpack-encore-bundle": "<2.0", + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" + }, + "add-lines": [ + { + "file": "webpack.config.js", + "content": [ + "", + " .enableVueLoader()" + ], + "position": "after_target", + "target": ".splitEntryChunks()" + }, + { + "file": "assets/app.js", + "content": [ + "import { registerVueControllerComponents } from '@symfony/ux-vue';" + ], + "position": "top", + "warn_if_missing": true + }, + { + "file": "assets/app.js", + "content": [ + "registerVueControllerComponents(require.context('./vue/controllers', true, /\\.vue$/));" + ], + "position": "bottom", + "warn_if_missing": true, + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/app.js", + "content": [ + "registerVueControllerComponents(import.meta.glob('./vue/controllers/**/*.vue', { eager: true }));" + ], + "position": "bottom", + "warn_if_missing": true, + "requires": "symfony/reprise" + }, + { + "file": "assets/app.js", + "content": [ + "registerVueControllerComponents();" + ], + "position": "bottom", + "warn_if_missing": true, + "requires": "symfony/asset-mapper" + } + ] +} diff --git a/symfony/ux-vue/3.4/post-install.txt b/symfony/ux-vue/3.4/post-install.txt new file mode 100644 index 00000000..226996ec --- /dev/null +++ b/symfony/ux-vue/3.4/post-install.txt @@ -0,0 +1,28 @@ + + * Using Vite? Install @vitejs/plugin-vue so Vite can compile + single-file components, and register it in your vite.config: + + npm install --save-dev @vitejs/plugin-vue + + import vue from '@vitejs/plugin-vue' + + export default defineConfig({ + plugins: [ + vue(), + Symfony({ /* ... */ }), + ], + }) + + * Using Rsbuild? Install @rsbuild/plugin-vue and register it in your + rsbuild.config: + + npm install --save-dev @rsbuild/plugin-vue + + import { pluginVue } from '@rsbuild/plugin-vue' + + export default defineConfig({ + plugins: [ + pluginVue(), + Symfony({ /* ... */ }), + ], + })