Skip to content

Commit

Permalink
Merge pull request #275 from nextcloud-libraries/backport/267/stable1
Browse files Browse the repository at this point in the history
[stable1] fix: Revert chunkFileNames to include hash
  • Loading branch information
susnux authored Aug 5, 2024
2 parents 36654a3 + cab7917 commit 33703c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions __tests__/css-entry-points.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* SPDX-License-Identifier: MIT
*/

// eslint-disable-next-line n/no-extraneous-import
import type { RollupOutput, OutputAsset } from 'rollup'

import { build } from 'vite'
import { describe, it, expect } from 'vitest'
import { CSSEntryPointsPlugin } from '../lib/plugins/CSSEntryPoints'
Expand Down
8 changes: 6 additions & 2 deletions lib/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const createAppConfig = (entries: { [entryAlias: string]: string }, optio
EmptyJSDirPlugin(
typeof options.emptyOutputDirectory === 'object'
? options.emptyOutputDirectory
: undefined
: undefined,
),
)
}
Expand Down Expand Up @@ -211,6 +211,10 @@ export const createAppConfig = (entries: { [entryAlias: string]: string }, optio
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
return 'img/[name][extname]'
} else if (/css/i.test(extType)) {
if (userConfig.build?.cssCodeSplit !== false) {
// we need hashed css name for css chunks as a cache buster
return 'css/[name]-[hash].css'
}
return `css/${assetsPrefix}[name].css`
} else if (/woff2?|ttf|otf/i.test(extType)) {
return 'css/fonts/[name][extname]'
Expand All @@ -221,7 +225,7 @@ export const createAppConfig = (entries: { [entryAlias: string]: string }, optio
return `js/${assetsPrefix}[name].mjs`
},
chunkFileNames: () => {
return 'js/[name].chunk.mjs'
return 'js/[name]-[hash].chunk.mjs'
},
manualChunks: {
...(options?.coreJS ? { polyfill: ['core-js'] } : {}),
Expand Down

0 comments on commit 33703c9

Please sign in to comment.