charliekassel / vuejs-datepicker

A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
MIT License
2.61k stars 730 forks source link

You are using the runtime-only build of Vue with vue2 #32

Closed chbinghu closed 7 years ago

chbinghu commented 7 years ago

thanks for your datepicker, and I got a problem in vue2 vue.common.js:2611[Vue warn]: You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build. (found in component ).

I just use it in a *.vue

<template lang="pug">
Datepicker
</template>

<script>
import Datepicker from 'vuejs-datepicker'

export default {
    components  : {
        Datepicker
   }
}
</script>
charliekassel commented 7 years ago

This can be resolved by adding this to your webpack config:

resolve: {
  alias: {
    vue: 'vue/dist/vue.js'
  }
}

See below: https://github.com/vuejs-templates/webpack/issues/215

jonataswalker commented 7 years ago

Hey @charliekassel and who doesn't use webpack? I use Rollup and runtime Vue.

benplain commented 7 years ago

Hi @charliekassel, I am also experiencing this error. I already have resolve: { alias: { vue: 'vue/dist/vue.js' } } in my webpack config. Interestingly, I am also using vue2-timepicker component without any problems. Not sure why yours is not working.

lambertbeekhuis commented 6 years ago

Can also be solved by using:

import Vue from 'vue/dist/vue.js';

In stead of: import Vue from 'vue';

you06 commented 6 years ago
resolve: {
  alias: {
    'vue$': 'vue/dist/vue.js'
  }
}

This works for me. Using vue: 'vue/dist/vue.js' will cause the error This dependency was not found.

mrcat323 commented 6 years ago

You can easily fix this, for example you have a main javascript file called, main.js and there instead of var Vue = require('vue'); you should do stuff like var Vue = require('./node_modules/vue/dist/vue.js'); basically it connects the Vue