use builtin functions

pull/4660/head
Divyansh Singh 5 months ago
parent 21eda0561f
commit aa29aada4d

@ -176,18 +176,6 @@ export function isAdditionalConfigFile(path: string) {
return additionalConfigRE.test(path) return additionalConfigRE.test(path)
} }
/**
* Make sure the path ends with a slash.
* If path points to a file, remove the filename component.
* @param path
* @returns
*/
function dirname(path: string) {
const segments = path.split('/')
segments[segments.length - 1] = ''
return segments.join('/')
}
async function gatherAdditionalConfig( async function gatherAdditionalConfig(
root: string, root: string,
command: 'serve' | 'build', command: 'serve' | 'build',
@ -208,7 +196,7 @@ async function gatherAdditionalConfig(
const exports = await Promise.all( const exports = await Promise.all(
candidates.map(async (file) => { candidates.map(async (file) => {
const id = '/' + dirname(slash(file)) const id = normalizePath(`/${path.dirname(file)}/`)
const configExports = await loadConfigFromFile( const configExports = await loadConfigFromFile(
{ command, mode }, { command, mode },

Loading…
Cancel
Save