question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug Report] Vuetify loader doesn't load components listed in external libraries

See original GitHub issue

Environment

Browsers: Google Chrome, Safari 12.1.2, Safari, Mozilla Firefox OS: Mac OS 10.14.6

Steps to reproduce

Reference a library such as vuetify-daterange-picker or another library that wraps Vuetify components.

In the main.js file add.

import Vue from 'vue';
import App from './App.vue';
import VuetifyDaterangePicker from "vuetify-daterange-picker";
import "vuetify-daterange-picker/dist/vuetify-daterange-picker.css";
import vuetify from './plugins/vuetify';

Vue.use(VuetifyDaterangePicker);

new Vue({
  vuetify,
  render: h => h(App)
}).$mount('#app');

In ./plugins/vuetify add

import Vue from 'vue';
import Vuetify from 'vuetify/lib';

Vue.use(Vuetify);

export default new Vuetify({
  icons: {
    iconfont: 'mdi'
  }
});

Implement the component like

<template>
  <v-daterange v-model="range"></v-daterange>
</template>

Expected Behavior

VAppBar and VToolbarTitle are loaded in a la carte mode.

Actual Behavior

The following error is generated in this scenario.

Unknown custom element: <v-list> - did you register the component correctly? For recursive components, make sure to provide the "name" option. found in ---> <VDaterange>

Reproduction Link

Other comments

The module currently uses configureWebpack to list that vuetify/lib as external.

module.exports = {
  configureWebpack: {
    ...(process.env.NODE_ENV === 'production'
      ? {
          externals: {
            'vuetify/lib': 'vuetify/lib',
            'date-fns': 'date-fns'
          }
        }
      : {})
  }
};

To work around the error you can skip a la carte mode and import import Vuetify from 'vuetify', but this is less than ideal since you lose tree shaking.

Is there an alternative way to implement and meet the following criteria:

  • Wrapping module doesn’t depend on vuetify (Peer dep only)
  • Consuming app can using a la carte mode and get all of the benefits of tree shaking
  • Consuming app doesn’t need to import any of the peer dependencies of the wrapping module.

Thank you so much in advance! I appreciate all of the great work you’ve put in to Vuetify. Please let me know if you need additional information.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
KaelWDcommented, Aug 27, 2019

Only in the case of something like https://github.com/vuetifyjs/vuetify/issues/4068

1reaction
khoathanglongcommented, Sep 1, 2020

Did anyone mange to make it work with webpack?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite vuetify plugin doesn't load components listed in external ...
I am creating a library that wraps Vuetify 3 components. But when I try to use the library it gives the following error:...
Read more >
Frequently asked questions — Vuetify
The vuetify-loader doesn't load all components. The vuetify-loader has limitations in dynamic components. Make sure to checkout the limitations ...
Read more >
How To Add Loading Indicators to a Vue.js Application
For this tutorial, you will install nprogress to use as your loading indicator. You won't be using npm or yarn for this. You...
Read more >
Beginner Vue.js Tutorial with User Login - Auth0
Learn how to build a Vue.js application from scratch and easily add authentication so that users can register and login.
Read more >
Font Awesome icons in Vue.js apps: A complete guide
That icon is later added to the library . Next, we load FontAwesomeIcon , which is the Vue component, and register it with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found