mirror of
https://github.com/symfony/recipes.git
synced 2026-09-18 18:46:40 +03:00
[UXVue][UXReact] Add Symfony Reprise support (#1546)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
export default function (props) {
|
||||
return <div>Hello {props.fullName}</div>;
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
* Using <fg=green>Vite</>? Install <fg=green>@vitejs/plugin-react</> so Vite can compile JSX,
|
||||
and register it in your <comment>vite.config</>:
|
||||
|
||||
<fg=green>npm install --save-dev @vitejs/plugin-react</>
|
||||
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react(),
|
||||
Symfony({ /* ... */ }),
|
||||
],
|
||||
})
|
||||
|
||||
* Using <fg=green>Rsbuild</>? Install <fg=green>@rsbuild/plugin-react</> and register it in your
|
||||
<comment>rsbuild.config</>:
|
||||
|
||||
<fg=green>npm install --save-dev @rsbuild/plugin-react</>
|
||||
|
||||
import { pluginReact } from '@rsbuild/plugin-react'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
pluginReact(),
|
||||
Symfony({ /* ... */ }),
|
||||
],
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div>Hello {{ name }}!</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
name: String
|
||||
});
|
||||
</script>
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
* Using <fg=green>Vite</>? Install <fg=green>@vitejs/plugin-vue</> so Vite can compile
|
||||
single-file components, and register it in your <comment>vite.config</>:
|
||||
|
||||
<fg=green>npm install --save-dev @vitejs/plugin-vue</>
|
||||
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
Symfony({ /* ... */ }),
|
||||
],
|
||||
})
|
||||
|
||||
* Using <fg=green>Rsbuild</>? Install <fg=green>@rsbuild/plugin-vue</> and register it in your
|
||||
<comment>rsbuild.config</>:
|
||||
|
||||
<fg=green>npm install --save-dev @rsbuild/plugin-vue</>
|
||||
|
||||
import { pluginVue } from '@rsbuild/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
pluginVue(),
|
||||
Symfony({ /* ... */ }),
|
||||
],
|
||||
})
|
||||
Reference in New Issue
Block a user