diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index a861ebf0d06836..6b09c265ffef16 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -166,7 +166,7 @@ export async function optimizeDeps( data.browserHash = createHash('sha256') .update(data.hash + JSON.stringify(deps)) .digest('hex') - .substr(0, 8) + .substring(0, 8) const missingIds = Object.keys(missing) if (missingIds.length) { @@ -408,5 +408,5 @@ function getDepHash(root: string, config: ResolvedConfig): string { return value } ) - return createHash('sha256').update(content).digest('hex').substr(0, 8) + return createHash('sha256').update(content).digest('hex').substring(0, 8) } diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index 2cd423ae528c79..0fa017ddb8c2f9 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -223,7 +223,7 @@ export function assetFileNamesToFileName( // placeholders for `assetFileNames` // `hash` is slightly different from the rollup's one const extname = path.extname(basename) - const ext = extname.substr(1) + const ext = extname.substring(1) const name = basename.slice(0, -extname.length) const hash = contentHash