Draake
Draake

Reputation: 93

How to add libraries vue in laravel?

I'm using laravel 5.4, with webpack and vue. I'm not sure how to add new libraries to use in vue.

For example, I run

npm install --save jquery vue2-select

What do I need to do next? I need to add:

Import Selectize from 'vue2-selectize'

or

Require ('vue2-selectize')

In the

resources / assets / js / app.js

file or

resources / assets / js / bootstrap.js

?

Can someone help me with the correct order to work?

Thank you!

Upvotes: 0

Views: 1274

Answers (1)

Andrii Kudriavtsev
Andrii Kudriavtsev

Reputation: 1304

import or require do almost same thing. But import is more popular.

  1. npm install --save jquery vue2-selectize You should run this in your root folder and npm will place those packages in 'node_modules'. Then import command will look in 'node_modules' and load it to your file.
  2. import Selectize from 'vue2-selectize' in that file where you want to use Selectize.
  3. resources / assets / js / app.js yes, this is where your front-end app start from. In vue documentation you can read more about single file components
  4. watch this laracast series and may be some other. They are easy to follow.

Upvotes: 1

Related Questions