gridjs-vue icon indicating copy to clipboard operation
gridjs-vue copied to clipboard

`Vue is not defined`

Open DanHulton opened this issue 3 years ago • 25 comments

Describe the bug Following the documentation exactly produces this error in the console.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://gridjs.io/docs/integrations/vue/
  2. Follow the documentation
  3. Attempt to load page.
  4. Console instead shows error ReferenceError: Vue is not defined.

Expected behavior Grid should display without error.

Desktop (please complete the following information):

  • OS: Mac OS 12.0.1
  • Browser: Firefox
  • Version: 94.0.1

Additional context

I am using Vue 3, but others have reported this same issue using Vue 2, here: https://github.com/grid-js/gridjs-vue/issues/426

It was staled when it really should not have been, as the issue is still active and a complete blocker.

DanHulton avatar Nov 28 '21 01:11 DanHulton

Having the same issue with Vue 2.

dombavetta avatar Nov 29 '21 01:11 dombavetta

I faced the same issue, can't use gridjs-vue 5+. Have to downgrade it to version 4, hope it will be fixed soon.

Dev314 avatar Nov 29 '21 23:11 Dev314

Is it resolved?

Dev314 avatar Dec 28 '21 17:12 Dev314

I think it's due to how modules are handled now... I ran into this issue and was able to resolve by adding Vue to the window. I'd say this only a work around but hopefully it helps someone.

import Vue from 'vue';
window.Vue = Vue;

missingno-io avatar Dec 29 '21 21:12 missingno-io

Same issue for me. No way to get it to work. Downgrade to v4 worked.

deviarte avatar Jan 08 '22 17:01 deviarte

How do I fix this for Nuxt3? I can't downgrade to v4 because of dependencies on vue3

JowJoris avatar Jan 26 '22 12:01 JowJoris

i have same issue

Grzyb9k avatar Jan 31 '22 22:01 Grzyb9k

I have the same issue in my new Vue3 application. main.esm.js?a234:1 Uncaught ReferenceError: Vue is not defined at Module.eval (main.esm.js?a234:1:1) at eval (main.esm.js:8:30) at Module../node_modules/gridjs-vue/dist/main.esm.js (chunk-vendors.js:2659:1) at __webpack_require__ (index.js:854:30) at fn (index.js:151:20) at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Home.vue?vue&type=script&lang=js:6:68) at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Home.vue?vue&type=script&lang=js (index.js:1031:1) at __webpack_require__ (index.js:854:30) at fn (index.js:151:20) at eval (Home.vue?026b:1:1)

heavyhelli avatar Feb 15 '22 10:02 heavyhelli

@selfagency Any ideas how to fix this?

JowJoris avatar Feb 17 '22 12:02 JowJoris

have the same issue. downgrading to 4 solves it, but results in many missing features.

bbjansen avatar Feb 17 '22 17:02 bbjansen

Sam issue for now with VueJS 3 ! Waiting for a fix to switch to production with GridJs !! Any one ?

fbmfbm avatar Feb 18 '22 09:02 fbmfbm

Same story here, can't even get the base example code to work. Any updates on this?

ZachVogt avatar Feb 23 '22 15:02 ZachVogt

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 27 '22 08:03 stale[bot]

@selfagency Are you there ?

kaanrkaan avatar Mar 27 '22 20:03 kaanrkaan

We really need a fix to this issue. Pleas someone heeelp

therealokoro avatar Apr 22 '22 13:04 therealokoro

+1

palanza avatar Apr 28 '22 13:04 palanza

+1

LeaderbotX400 avatar May 12 '22 23:05 LeaderbotX400

Same here

KayahanKahriman avatar May 13 '22 07:05 KayahanKahriman

+1

aphavichitr avatar May 13 '22 23:05 aphavichitr

I think it's due to how modules are handled now... I ran into this issue and was able to resolve by adding Vue to the window. I'd say this only a work around but hopefully it helps someone.

import Vue from 'vue';
window.Vue = Vue;

@missingno-io Where did you add this? I tried adding it and it still wasn't resolving.

aphavichitr avatar May 16 '22 21:05 aphavichitr

I think the issue is this library isn't supporting Vue 3, I found this thread with a fork for Vue 3 compatibility, but I've decided to use the Vanilla JS implementation.

https://github.com/grid-js/gridjs-vue/issues/312#issuecomment-911820153

aphavichitr avatar May 16 '22 23:05 aphavichitr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 18 '22 19:06 stale[bot]

Hi everyone,

I'am trying to use GridJS with vue3 but as I see the problem is still not fixed, do someone has an idea to fix it ?

AbakusToTheMoon avatar Jun 21 '22 14:06 AbakusToTheMoon

I was able to use gridjs with vue, but this was with the gridjs core library and not the wrapper for vue i.e gridjs-vue.

Here is how i used it

<script setup lang="ts">
	import { Grid } from "gridjs"
	import "gridjs/dist/theme/mermaid.css"

       // create a ref to hold the table in template
	const myTable = ref()
        // create a ref variable to hold new gridjs instance
	const gridjs = ref()

	onMounted(() => {
		gridjs.value = new Grid({
			columns: ["Name", "Email", "Phone Number"],
			data: [
				["John", "[email protected]", "(353) 01 222 3333"],
				["Mark", "[email protected]", "(01) 22 888 4444"],
				["Eoin", "[email protected]", "0097 22 654 00033"],
				["Sarah", "[email protected]", "+322 876 1233"],
				["Afshin", "[email protected]", "(353) 22 87 8356"]
			],
			pagination: true,
			search: true,
			sort: true
		})

		gridjs.value.render(myTable.value)
		gridjs.value.on("cellClick", (...args: any) => console.log(args))
	})
</script>

<template>
	<h3 class="text-lg font-semibold">Gridjs Table</h3>
	<div id="id" ref="myTable"></div>
</template>

<style></style>

therealokoro avatar Jun 21 '22 15:06 therealokoro

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 30 '22 18:07 stale[bot]

Still face this error

tuanhaviet22 avatar Feb 07 '23 07:02 tuanhaviet22

still facing this error...

vitalibr avatar Mar 19 '23 19:03 vitalibr

Same error for me...

XAldrikX avatar Jul 19 '23 21:07 XAldrikX

Also have the same issue with vue 3.2.45 and gridjs-vue 5.0.4

randomComitter avatar Aug 07 '23 12:08 randomComitter