简体   繁体   中英

Meteor 1.3 modules - how to use npm imported libraries in the console?

I'm using Meteor 1.3 with ES32015 modules and native npm support, and I'm using momentjs from npm:

import moment from 'moment';

It all works fine in the project, but when I want to test out moment in the console, it says that it's undefined . Can I somehow import in the runtime?

Use import moment from 'moment';

Make sure you are putting () to the imported module.

console.log(moment());

var moment = require('moment')()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM