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

Import some components only on client #86

Open
mathe42 opened this issue Aug 8, 2020 · 1 comment
Open

Import some components only on client #86

mathe42 opened this issue Aug 8, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@mathe42
Copy link

mathe42 commented Aug 8, 2020

Is your feature request related to a problem? Please describe.
I want to use this feature with https://github.com/vue-leaflet/Vue2Leaflet.
The problem is that this imports Leaflet with depends on window beeing pressent (even when only importing it)

Describe the solution you'd like
Have an option for a folder clientOnly: true if this is set on serverside only a dummy container is loaded.

// In production
const dummy = {render:()=>null}

// In dev
const dummy = {render:(h)=>h('You have to wrap the components inside the client-only component')}

Describe alternatives you've considered
Currently I'm useing the vuetify loader with custim components that I generate from the https://github.com/vue-leaflet/Vue2Leaflet file structure.

Additional context
User has to additionaly wrap the components in a client-only

@njbarrett
Copy link

njbarrett commented Oct 16, 2020

I managed to get around this by using the ignore option.
Name your component that is client only something like component.client.vue and in the config put

  components: [
    { path: '~/components', extensions: ['vue'], ignore: ['*.client.vue'] },
  ],

You still need to use <client-only> wrapping the component. And you will have to manually import the component too.

@pi0 pi0 added the enhancement New feature or request label Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants