Skip to content
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

Add auto-wiring of Views #5

Closed
DaniJG opened this issue May 17, 2019 · 0 comments
Closed

Add auto-wiring of Views #5

DaniJG opened this issue May 17, 2019 · 0 comments
Assignees

Comments

@DaniJG
Copy link
Contributor

DaniJG commented May 17, 2019

Similar to the auto-wiring of components, different folder.

Using changes added from GH-9, explore the possibility to include all components inside a view folder as "async" components in the same chunk.

A possible convention to achieve this would be:

  • The root component for every View ends with either .vue or .async.vue, ignoring any files ending with .local.vue
  • The components exclusive to each of these views end with .local.vue and can be placed either inside the /components or /views folder (since both views and components convention will ignore them).
  • The convention will then scan for:
    • Files ending with .vue, but not .async.vue and .local.vue inside the /views folder as part of the sync context. (a require.context generated with the default sync mode)
    • Files ending with .async.vue inside the /views folder as part of the async context (a require.context generated with the lazy mode)
  • Vue routers declare their component as component: Vue.component('my-component-name') where the name is the one Autowire uses to register it based on the file name

This will give us a somewhat decent compromise between autowiring and automatic code-split per route.

For example, given a folder structure like:

/views
    home.vue
    about.async.vue
    /user-profile
        user-profile.async.vue
        security-preferences.local.vue
        profile-picture.local.vue

The convention would find 2 async views (user-profile and about) and a sync view (home). Both async views will get its own webpack chunk, that includes local components referenced by them.

For a more automated wiring of all the views and their exclusive components that maintains code splitting capabilities, we will need to explore GH-13

@DaniJG DaniJG self-assigned this May 30, 2019
DaniJG pushed a commit that referenced this issue May 30, 2019
DaniJG added a commit that referenced this issue May 30, 2019
@DaniJG DaniJG closed this as completed May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant