Skip to Content
Vue.js 2 Cookbook
book

Vue.js 2 Cookbook

by Andrea Passaglia
April 2017
Intermediate to advanced
454 pages
12h 51m
English
Packt Publishing
Content preview from Vue.js 2 Cookbook

Adding dependencies with npm

To add external libraries in this configuration you simply type npm install followed by the name of the library. Then in your code you use it with something along the lines of the following:

import MyLibrary from 'mylibrary'

We can import moment.js with the following command:

npm install moment

Then in our JavaScript we add the following lines:

import moment from 'moment'
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Vue.js 2

Learning Vue.js 2

Olga Filipova
Pro Vue.js 2

Pro Vue.js 2

Adam Freeman

Publisher Resources

ISBN: 9781786468093Supplemental Content