2

I am very new to Vue and node and I am trying to insert a global value in my project but to do so I want to put my index.html in a public dir. I first create a project, but the public src was not created, and I can run it with:

$ npm run dev

If I create the public dir and put the index.html into it, I got an fatal error (without any other message) when I run $ npm run dev. So I installed @vue/cli-service with node, by $ npm install --save @vue/cli-service but nothing change, I have also try to find vue.config.js, that is mentioned in this question, but I didn't find it.

(In my package.json there is this dependecies: "@vue/cli-service": "^3.0.0",)

What am I doing wrong? Thank you

PS: What I am trying to do is to use this and add BAse_URL in my index File, but before that, If I put index.html in the public dir I got the error

tony19
  • 125,647
  • 18
  • 229
  • 307
Liz Lamperouge
  • 681
  • 14
  • 38

1 Answers1

3

With Vue-CLI 3 and 4 (and up) no index.html is created in the src folder. So if you want to include any file to your project (such as a CSS file or Jquery Library), you can simply import that in App.vue:

import './assets/css/yourstyles.css';

or in one of the styles globally (for CSS files):

<style>
@import './assets/styles/yourstyles.css';
</style>
Hadi Masoumi
  • 1,153
  • 9
  • 13