Danyal Sandeelo
Danyal Sandeelo

Reputation: 12391

Include JS file in .vue file

I have to include pusher.js in my .vue file like this:

<script src="https://js.pusher.com/5.1/pusher.min.js"></script>

I can see in the console ReferenceError: Pusher is not defined.

How can we include js files like this in .vue files? I cant even execute the js code in <script> tags.

Upvotes: 0

Views: 93

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

You can't include script directly in .vue file. Rather, you have to import the file:

import Pusher from 'path-to-pusher'

Upvotes: 3

Related Questions