Problem including JS file in project with Vuejs 2

Asked

Viewed 285 times

0

I have the following problem: By including a local file . js in my project with Vuejs I get the following error message.

inserir a descrição da imagem aqui inserir a descrição da imagem aqui

Follow my structure and code:

inserir a descrição da imagem aqui

I realized that if you include an external file, via CDN for example, it works perfectly. Thank you all for your help.

1 answer

0

Simple guy, realized that the script is being called after the tag body. Correct would be:

<body><script src="/../rocketstore/dist/js/mais.min.js"></script></body>
  • I understood, I had already tried to pass inside the body, without success. It would be like this that you scored: <body> <script src="/.. /rocketstore/dist/js/main.min.js"></script> </body>

  • Strange, you had already put inside the body tag and it still didn’t work. Does the following the way there tbm is wrong. You are already at the root of the project, no need to call /../rocketstore. Put dist/js/main.min.js that will work.

  • It’s the way it’s really wrong, hehe. It’s what I was trying to do anyway. I fixed the way and it still didn’t work. I think it’s a problem with the Vue-router with the webpack. Because when I click the script path in the source code, it directs to: http://localhost:8080/dist/js/main.min.js#/ and instead of loading the script, loads the default view html.

  • I understood, if the link is already being directed, the file is already running. You have to see right there how is the routing there in the project.

  • Thanks for the availability friend.

  • Blza man, ask a new question by putting the scripts to get help with this problem with the router.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.