Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: manualChunksの指定が誤っていてビルド再現性がなかった #4150

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ export default defineConfig(({ command, mode }) => ({
if (['@traptitech/traq/', 'axios'].some(t => id.includes(t))) {
return 'apis'
}
if (id.includes('node_modules/highlight.js')) {
const hljsLangs = 'node_modules/highlight.js/lib/languages/'
const hljsLangIndex = id.indexOf(hljsLangs)
if (id.includes(hljsLangs)) {
// hljsは適当に二つに分割する
const t = 'node_modules/highlight.js/lib/languages/'
const firstLetter = id.slice(id.indexOf(t) + t.length)[0]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidに含まれていないときid.indexOf(t)-1なので、t.length - 1番目の文字を見ていた

const firstLetter = id[hljsLangIndex + hljsLangs.length]
if (firstLetter < 'i') {
return 'hljs'
}
Expand Down