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

How to integrate with vite ? #260

Open
patrickelectric opened this issue Sep 15, 2023 · 2 comments
Open

How to integrate with vite ? #260

patrickelectric opened this issue Sep 15, 2023 · 2 comments

Comments

@patrickelectric
Copy link

I'm trying to do the integration with:

export default defineConfig({
  plugins: [
    vue(),
    VitePWA({
      registerType: 'autoUpdate',
      devOptions: {
        enabled: true,
      },
      includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'],
    }),
    Components({
      // generate `components.d.ts` global declarations
      // https://github.com/antfu/unplugin-vue-components#typescript
      dts: true,
      // auto import for directives
      directives: false,
      // resolvers for custom components
      resolvers: [
        // Vuetify
        VuetifyResolver(),
      ],
      // https://github.com/antfu/unplugin-vue-components#types-for-global-registered-components
      types: [
        {
          from: 'vue-router',
          names: ['RouterLink', 'RouterView'],
        },
        {
          from: 'vue-tour',
          names: ['VTour'],
        },
      ],
      // Vue version of project.
      version: 2.7,
    }),
  ],

But with no luck

@patrickelectric
Copy link
Author

patrickelectric commented Oct 17, 2023

I also imported it manually on the webpage that's necessary.

[Vue warn]: Failed to mount component: template or render function not defined.

found in

---> <VueTour>
       <VApp>
         <App> at /Users/patrick/git/blue/blueos/core/frontend/src/App.vue
           <Root>

@solbreslin
Copy link

solbreslin commented Jan 12, 2024

I fixed this by adding VTour to a VuetifyResolver ignore list. Here's the relevant part of the vite config:

import Components from "unplugin-vue-components/vite";
import { VuetifyResolver } from "unplugin-vue-components/resolvers";

const CustomVuetifyResolver = {
  type: "component",
  resolve: name => {
    const ignored = ["VStripe", "VTour", "VStep"];
    if (ignored.some(prefix => name.startsWith(prefix))) return;

    return VuetifyResolver().resolve(name);
  }
};
export default defineConfig(({ command, mode }) => {
  const config = {
    plugins: [
      vue(),
      Components({
        resolvers: [CustomVuetifyResolver]
      })
    ],
   

  return config;
});

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

2 participants