0

I'm writing a program using the vue js framework. After I build the project I have the following files:

dist
--index.html
--assets
  --style.css
  --script.js

After I start server with this files, all files under assets directory could not be found. They are connected to the html file in the following directory: "/assets/script.js" or "/assets/style.css". But when I changing href to this: "dist/assets/script.js" all works fine. Could you tell me why the first option does not want to work and also how to configure the vue project so that the correct href is specified in the html file.

1 Answers1

0

Try to create vite.config.js in root of you project, and check output structure:

module.exports = {
  root: 'src',
  build: {
    outDir: '../dist'
  }
}

More info: https://vitejs.dev/config/#build-outdir

Also try check this question: Vite - change ouput directory of assets

BalgabayevD
  • 44
  • 1
  • 4