-
-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UX Vue] Add lines for components lazy-loading #1246
Conversation
Hi, this PR follows symfony/ux#1177 (comment). The added lines were removed from the documentation, but I really think we should still document the lazy-loading behavior of Vue controller components (thanks to `'lazy'` parameter).
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. symfony/ux-vue2.8 vs 2.9diff --git a/symfony/ux-vue/2.9/assets/vue/controllers/Hello.vue b/symfony/ux-vue/2.9/assets/vue/controllers/Hello.vue
new file mode 100644
index 0000000..2812aa4
--- /dev/null
+++ b/symfony/ux-vue/2.9/assets/vue/controllers/Hello.vue
@@ -0,0 +1,9 @@
+<template>
+ <div>Hello {{ name }}!</div>
+</template>
+
+<script setup>
+ defineProps({
+ name: String
+ });
+</script>
diff --git a/symfony/ux-vue/2.8/manifest.json b/symfony/ux-vue/2.9/manifest.json
index 9010c6f..fbbef85 100644
--- a/symfony/ux-vue/2.8/manifest.json
+++ b/symfony/ux-vue/2.9/manifest.json
@@ -1,5 +1,61 @@
{
"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": "\n .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": "// If you prefer to lazy-load your Vue.js controller components, in order to reduce the JavaScript bundle the smallest as possible",
+ "position": "bottom",
+ "warn_if_missing": true,
+ "requires": "symfony/webpack-encore-bundle"
+ },
+ {
+ "file": "assets/app.js",
+ "content": "// and degrade performances as little as possible, you can use the following line instead:",
+ "position": "bottom",
+ "warn_if_missing": true,
+ "requires": "symfony/webpack-encore-bundle"
+ },
+ {
+ "file": "assets/app.js",
+ "content": "registerVueControllerComponents(require.context('./vue/controllers', true, /\\.vue$/, 'lazy'));",
+ "position": "bottom",
+ "warn_if_missing": true,
+ "requires": "symfony/webpack-encore-bundle"
+ },
+ {
+ "file": "assets/app.js",
+ "content": "registerVueControllerComponents();",
+ "position": "bottom",
+ "warn_if_missing": true,
+ "requires": "symfony/asset-mapper"
+ }
+ ]
} |
Head branch was pushed to by a user without write access
"position": "bottom", | ||
"warn_if_missing": true, | ||
"requires": "symfony/webpack-encore-bundle" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening - but I think I'd rather mention this in the docs - vs adding 4 lines to the user's app.js
Pull request was closed
Hi, this PR follows symfony/ux#1177 (comment).
The added lines were removed from the documentation, but I really think we should still document the lazy-loading behavior of Vue controller components (thanks to
'lazy'
parameter).cc @weaverryan