reinerBa / Vue-Responsive

A plugin for responsive handling with vue.js
https://reinerba.github.io/Vue-Responsive/dist/
MIT License
99 stars 6 forks source link

ReferenceError: Vue is not defined #1

Closed kdcl closed 6 years ago

kdcl commented 7 years ago

thank for your project( vue-resposive) , but when i use in vue-cli, use import to my vue file,

import '../assets/js/Vue-Responsive.js'; it always say ReferenceError: Vue is not defined (line 141) result also like https://npm.runkit.com/vue-responsive/Vue-Responsive.js?t=1503480379488 Can you help the solve it?or i do something wrong?

reinerBa commented 7 years ago

Hi, i wrote in a check for the global vue. A workaround on your side would be to define "Vue" as global in webpack config.

I would recommend you to import the commonjs module with import vueResponsive from 'vue-responsive/dist/Vue_Responsive.common'

For instance in your app.vue you can write

import vueResponsive from 'vue-responsive/dist/Vue_Responsive.common' import Vue from 'vue' Vue.directive('responsiveness', vueResponsive);

to define the directive globaly.