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.

directive not working vite app

See original GitHub issue

I tried using both presets and a custom directive with this component and faced issues where the environment crashes.

<template>
  <article v-motion-fade-visible  class="my-2 flex md:h-32">
    <code class="w-full text-sm xl:text-xl leading-loose">
      <div>
        <span class="text-blue-600">const</span>
        <span class="ml-2 text-orange-400">lakshya</span>
        :
        <span class="text-green-400">Ingredient</span>
        []
        <span class="text-blue-600">=</span>
        [
      </div>
      <div class="lg:pl-8">
        <span class="text-red-500">Hacker</span>,
        <span class="text-red-500">Developer</span>,
        <span class="text-red-500">Photographer</span>,
        <span class="text-red-500">Writer</span>,
      </div>
      <div class="lg:pl-8">
        <span class="text-red-500">Cool</span>,
        <span class="text-red-500">Hot</span>,
        <span class="text-red-500">...everythingNice</span>
      </div>
      <div>];</div>
    </code>
  </article>
</template>

This was what was logged into the console rest of the page was not rendering anything

Screenshot_20210502_012609

This is how am registering the plugin. The other plugins registered include @vueuse/head, vue-router and vue-i18n

import { MotionPlugin } from '@vueuse/motion'
import 'virtual:windi-devtools'
import 'virtual:windi.css'
import { createApp } from 'vue'
import App from './App.vue'
import { head, i18n, router } from './modules'

const app = createApp(App)
app.use(head)
app.use(i18n)
app.use(router)
app.use(MotionPlugin)

app.mount('#app')

My Vite config is as follows

import VueI18n from '@intlify/vite-plugin-vue-i18n'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { defineConfig } from 'vite'
import ViteComponents from 'vite-plugin-components'
import ViteFonts from 'vite-plugin-fonts'
import Icons, { ViteIconsResolver } from 'vite-plugin-icons'
import Markdown from 'vite-plugin-md'
import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts'
import WindiCSS from 'vite-plugin-windicss'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: [
      {
        find: '@components',
        replacement: path.resolve(__dirname, './src/components')
      },
      { find: '@assets', replacement: path.resolve(__dirname, './src/assets') },
      { find: '@', replacement: path.resolve(__dirname, './src') }
    ]
  },
  plugins: [
    vue({
      include: [/\.vue$/, /\.md$/]
    }),
    Pages({
      extensions: ['vue', 'md']
    }),
    Layouts(),
    Markdown({
      wrapperClasses: 'prose prose-sm m-auto text-left',
      headEnabled: true
    }),
    ViteComponents({
      extensions: ['vue', 'md'],
      customLoaderMatcher: (id) => id.endsWith('.md'),
      customComponentResolvers: ViteIconsResolver({
        componentPrefix: '',
        enabledCollections: ['mdi', 'carbon']
      })
    }),
    Icons({
      defaultStyle: 'vertical-align: middle;'
    }),
    WindiCSS({
      safelist: 'prose prose-sm m-auto text-left'
    }),
    VueI18n({
      include: [path.resolve(__dirname, 'locales/**')]
    }),
    ViteFonts({
      google: {
        families: ['Satisfy']
      }
    })
  ],
  optimizeDeps: {
    include: ['vue', 'vue-router', '@vueuse/core']
  }
})

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Tahulcommented, May 10, 2021

Hey @king-11 ; I will need to take a deep look into that soon.

Sorry for the late answer, I’m really busy at the moment.

I’ll be using @vueuse/motion in a project soon and will need to fix that issue anyways.

Thanks for the issue and stay posted here for the updates.

0reactions
Tahulcommented, May 13, 2021

You can reach me on Discord if you want, Tahul#3734

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Laravel Vite Directive Not Working in My Project?
Laravel 8 documentation says to install the laravel breeze using the following command. composer require laravel/breeze --dev.
Read more >
Configuration "resources/js/app.js" does not exist. #65 - GitHub
Installed the official package, cleared the cache, but now have a white screen. It does however look like the @Vite directive is working...
Read more >
Laravel vite deployment not working - Laracasts
Hello, I am deploying a website that I created with laravel 9 and vite. ... however, the @ vite directive doesn`t work and...
Read more >
Features | Vite
Vite only performs transpilation on .ts files and does NOT perform type checking. It assumes type checking is taken care of by your...
Read more >
How to Fix Vite Directive Not Working in Laravel Breeze
First, you should create a new Laravel application, configure your database, and run your database migrations. Once you have created a new ...
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