diez icon indicating copy to clipboard operation
diez copied to clipboard

Problem with Docs build process

Open acespace90 opened this issue 4 years ago • 1 comments

Version: 10.6.0

Hi I launched the yarn build command, it generates the dist folder but when I upload on the server nothing happens. It only works in local if I run npx http-server dist as the guide here explains.

I discovered two things:

  • All static assets in index.html files appears like so
<script src=/js/chunk-vendors.4e5716f4.js></script>

without the double quote and mistakenly pointing to the file. It should appear like so instead

<script src="./js/chunk-vendors.4e5716f4.js"></script>
  • Same error occurs into /js/app.js file when fetching tree.json file it should be like so
fetch("./assets/tree.json");

Obviously, these manual changes must be made every time you build the app resulting in a tedious job.

What am I wrong?

Thanks in advice

acespace90 avatar Feb 24 '21 15:02 acespace90

Hi @acespace90!

without the double quote and mistakenly pointing to the file.

This is not managed by Diez directly (DocsGen its a Vue app built by the Vue CLI itself). Don't worry about the attributes being unquoted they are valid in this case.

Obviously, these manual changes must be made every time you build the app resulting in a tedious job.

The file paths are relative file paths, in this case the build is expecting to find the files at the root of your website.

For example if your website is https://example.com, the browser will look for the files at https://example.com/js/chunk-vendors.4e5716f4.js and https://example.com/assets/tree.json.

You can fix this by deploying your files to the expected path.

Having said that, we should really:

  • Provide config options to modify this path, probably by checking for a config file and then merging with https://github.com/diez/diez/blob/master/src/utils/docs-template-app/vue.config.js
  • Improve the docs

Does this answer your question?

roperzh avatar Feb 24 '21 18:02 roperzh