Skip to content

Commit 4f89d39

Browse files
committed
chore(core): sync webpack chunk name with vite
1 parent a250c76 commit 4f89d39

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

packages/core/src/page/resolvePageChunkInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { hash, path } from '@vuepress/utils'
1+
import { path, sanitizeFileName } from '@vuepress/utils'
22
import type { App } from '../types/index.js'
33

44
/**
@@ -17,7 +17,7 @@ export const resolvePageChunkInfo = ({
1717
} => {
1818
const chunkFilePathRelative = path.join('pages', `${htmlFilePathRelative}.js`)
1919
const chunkFilePath = app.dir.temp(chunkFilePathRelative)
20-
const chunkName = `v-${hash(htmlFilePathRelative)}`
20+
const chunkName = sanitizeFileName(path.basename(htmlFilePathRelative))
2121

2222
return {
2323
chunkFilePath,

packages/core/tests/page/resolvePageChunkInfo.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { hash, path } from '@vuepress/utils'
1+
import { path, sanitizeFileName } from '@vuepress/utils'
22
import { describe, expect, it } from 'vitest'
33
import { createBaseApp, resolvePageChunkInfo } from '../../src/index.js'
44

@@ -18,7 +18,7 @@ describe('core > page > resolvePageChunkInfo', () => {
1818
expect(resolved).toEqual({
1919
chunkFilePath: app.dir.temp('pages/foo.html.js'),
2020
chunkFilePathRelative: 'pages/foo.html.js',
21-
chunkName: `v-${hash('foo.html')}`,
21+
chunkName: sanitizeFileName('foo.html'),
2222
})
2323
})
2424
})

packages/core/tests/page/resolvePageDataInfo.spec.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)