Skip to content

Commit

Permalink
fix: modify code to respond to changes to assetInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonghakseo committed Nov 18, 2023
1 parent 771b9a2 commit 46c0cd8
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ export default defineConfig({
entryFileNames: 'src/pages/[name]/index.js',
chunkFileNames: isDev ? 'assets/js/[name].js' : 'assets/js/[name].[hash].js',
assetFileNames: assetInfo => {
const { dir, name: _name } = path.parse(assetInfo.name);
const assetFolder = dir.split('/').at(-1);
const name = assetFolder + firstUpperCase(_name);
const { name } = path.parse(assetInfo.name);
console.log(assetInfo.name, name);
if (name === 'contentStyle') {
return `assets/css/contentStyle${cacheInvalidationKey}.chunk.css`;
}
Expand All @@ -75,11 +74,6 @@ export default defineConfig({
},
});

function firstUpperCase(str: string) {
const firstAlphabet = new RegExp(/( |^)[a-z]/, 'g');
return str.toLowerCase().replace(firstAlphabet, L => L.toUpperCase());
}

let cacheInvalidationKey: string = generateKey();
function regenerateCacheInvalidationKey() {
cacheInvalidationKey = generateKey();
Expand Down

0 comments on commit 46c0cd8

Please sign in to comment.