Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Aug 5, 2024
1 parent 25e3aee commit 0166738
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {

const toRelative = (filename: string) => {
// relative base + extracted CSS
const relativePath = normalizePath(
path.relative(cssAssetDirname!, filename),
)
const relativePath = path.relative(cssAssetDirname!, filename)
return relativePath[0] === '.' ? relativePath : './' + relativePath
}

Expand All @@ -617,8 +615,9 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
})
// resolve public URL from CSS paths
if (encodedPublicUrls) {
const relativePathToPublicFromCSS = normalizePath(
path.relative(cssAssetDirname!, ''),
const relativePathToPublicFromCSS = path.relative(
cssAssetDirname!,
'',
)
chunkCSS = chunkCSS.replace(publicAssetUrlRE, (_, hash) => {
const publicUrl = publicAssetUrlMap.get(hash)!.slice(1)
Expand Down
6 changes: 2 additions & 4 deletions packages/vite/src/node/plugins/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
async transform(html, id) {
if (id.endsWith('.html')) {
id = normalizePath(id)
const relativeUrlPath = normalizePath(path.relative(config.root, id))
const relativeUrlPath = path.relative(config.root, id)
const publicPath = `/${relativeUrlPath}`
const publicBase = getBaseInHTML(relativeUrlPath, config)

Expand Down Expand Up @@ -776,9 +776,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
}

for (const [normalizedId, html] of processedHtml) {
const relativeUrlPath = normalizePath(
path.relative(config.root, normalizedId),
)
const relativeUrlPath = path.relative(config.root, normalizedId)
const assetsBase = getBaseInHTML(relativeUrlPath, config)
const toOutputFilePath = (
filename: string,
Expand Down

0 comments on commit 0166738

Please sign in to comment.