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

Cannot redefine property: $moment

Open vince015 opened this issue 4 years ago • 1 comments

Getting this error: Cannot redefine property: $moment

<script>
import Vue from 'vue';
Vue.use(require('vue-moment'));
...
</script>

version: 4.1.0

vince015 avatar Mar 15 '20 00:03 vince015

I had the same issue, in my case a vue component I have written as npm module uses VueMoment and then the host app also uses VueMoment, which ever is loaded last gets the error. In my case I have worked around with the following:

if (!Vue.moment) {
  Vue.use(VueMoment)
}

stewartmckee avatar Jun 24 '20 22:06 stewartmckee