File tree 3 files changed +10
-2
lines changed
3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
- import { path , sanitizeFileName } from '@vuepress/utils'
1
+ import { path , transformPathToFileName } from '@vuepress/utils'
2
2
import type { App } from '../types/index.js'
3
3
4
4
/**
@@ -17,7 +17,7 @@ export const resolvePageChunkInfo = ({
17
17
} => {
18
18
const chunkFilePathRelative = path . join ( 'pages' , `${ htmlFilePathRelative } .js` )
19
19
const chunkFilePath = app . dir . temp ( chunkFilePathRelative )
20
- const chunkName = sanitizeFileName ( path . basename ( htmlFilePathRelative ) )
20
+ const chunkName = transformPathToFileName ( htmlFilePathRelative )
21
21
22
22
return {
23
23
chunkFilePath,
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ export * from './getDirname.js'
2
2
export * from './importFile.js'
3
3
export * from './isChildPath.js'
4
4
export * from './sanitizeFileName.js'
5
+ export * from './transformPathToFileName.js'
Original file line number Diff line number Diff line change
1
+ import { sanitizeFileName } from './sanitizeFileName.js'
2
+
3
+ /**
4
+ * Transforms a path to a file name, replacing slashes with underscores
5
+ */
6
+ export const transformPathToFileName = ( rawPath : string ) : string =>
7
+ sanitizeFileName ( rawPath . replace ( / \/ / g, '_' ) )
You can’t perform that action at this time.
1 commit comments
Mister-Hope commentedon Apr 22, 2024
This implementation probably works, but not sure if the chunkname is good to use. Maybe it would be a little long I guess?