"ReferenceError: moment is not defined"
See original GitHub issueI’m wondering how people are getting this to work. I am building an app with Laravel and Vue.
In my app.js
I import Moment:
import Moment from 'vue-moment';
Vue.use( Moment );
Then in my component:
methods : {
date : function( timestamp ) {
return moment( timestamp );
}
}
Which results in:
"ReferenceError: moment is not defined"
I also tried Vue.use(require('vue-moment'));
and different combinations of upper/lowercase. Any clue?
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Reference Error: moment is not defined (Using moment.js)
I have a folder that i've installed moment.js into (npm install moment) and i'm running my program (node isDate.js). import {moment} from ' ......
Read more >"Uncaught ReferenceError: moment is not defined" using NPM
I installed Moment.js using npm: npm install moment. I'd now like to compile it using npm run ... "Uncaught ReferenceError: moment is not...
Read more >ReferenceError: moment is not defined · Issue #4572 - GitHub
I've use the latest version of moment js and include the minified js at the top of my script. Most of the time...
Read more >Uncaught ReferenceError: moment is not defined
Hi! After updating to EA 2.3.5 I'm getting errors in the console like the ones below. The interesting thing is that it only...
Read more >[Solved]-"moment is not defined" using moment.js-moment.js
Related Query · moment is not defined - trying to reference moment function using ejs · Reference Error: moment is not defined (Using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fairking I have updated the readme in #163 while I test including the type definitions as part of this package
The moment instance is added to the prototype of a Vue and so can be accessed like this in your Vue component.
This is explained at the bottom of the readme and should still be working as intended. https://github.com/brockpetrie/vue-moment#thismoment
But if all you need is to return some formatted timestamps and not use any of the additional filter functionality, it sounds like using vanila moment.js will probably work best for you.