M
M
Mirzamorph2020-07-30 19:27:06
webpack
Mirzamorph, 2020-07-30 19:27:06

How to include external scripts in vue cli?

Good afternoon.
The admin panel was bought and now the task is to implement it using vue.js and vue cli.

I can’t connect scripts, I also tried in public/index.html in the script tag - I get the error Uncaught SyntaxError: Unexpected token '<'

I tried one more way: I created the lib.js file in the scr folder and did import './assets/ in it ...', in this case the build didn't build at all, there wasn't even an error, so I ended up creating a new project with vue cli but didn't add eslint to check what was wrong.

As a result, I received an error - ReferenceError: jQuery is not defined

Screenshots below:
5f22f42d02dbe738043891.png

This is how they suggest doing it according to the instructions, but nothing about SPA is written there:
5f22f49a2376f932035310.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2020-07-31
@Mirzamorph

I manage to include jquery in public/index.html:

<title><%= htmlWebpackPlugin.options.title %></title>
<script src="/resources/jquery/3.4.1/jquery.min.js"></script>

where resources is a folder in public.
But I would still install not manually, but through npm . I checked, everything works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question