vbenjs / vue-vben-admin

A modern vue admin panel built with Vue3, Shadcn UI, Vite, TypeScript, and Monorepo. It's fast!
https://www.vben.pro
MIT License
24.43k stars 6.67k forks source link

fix: improve build file naming convention and caching #3908

Closed doraemonxxx closed 3 months ago

doraemonxxx commented 3 months ago

Reference issue: https://github.com/vbenjs/vue-vben-admin/issues/3905 In revision: https://github.com/vbenjs/vue-vben-admin/commit/a6086f4cc8f33fea7431f3d39eb73dda20c325bd

(EDITED) Using entryFileNames: 'index.js' in Vite is generally not recommended due to several issues:

  1. Debugging Difficulty: Identical filenames make debugging harder as they don't reflect their origin or purpose.

Advantages of using [name]-[hash]

  1. Clarity: Each output file retains a clear connection to its entry file, making it easier to identify what each file corresponds to.
  2. Consistency: This naming convention is more consistent if you have many files, as each file keeps its original name with a hash appended, making the build output more organized and predictable.

Also in Dockerfile it uses entry directory

CMD sed -i "s|__vg_base_url|$VG_BASE_URL|g" /usr/share/nginx/html/dist/assets/entry/index-*.js

https://github.com/vbenjs/vue-vben-admin/blob/8d3981f599f073b226c822a8d28af9aecf00a667/Dockerfile#L23C2-L23C99

General

✏️ Mark the necessary items without changing the structure of the PR template.

Type

ℹ️ What types of changes does your code introduce?

👉 Put an x in the boxes that apply

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

👉 Put an x in the boxes that apply.

wangjue666 commented 3 months ago

cc @xachary