Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: normalise css paths in manifest on windows (fixes #9295) #9353

Merged
merged 4 commits into from Jul 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/manifest.ts
Expand Up @@ -103,7 +103,7 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {
function createAsset(chunk: OutputAsset): ManifestChunk {
const manifestChunk: ManifestChunk = {
file: chunk.fileName,
src: chunk.name
src: normalizePath(chunk.name!)
}

if (cssEntryFiles.has(chunk.name!)) manifestChunk.isEntry = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if this reference to chunk.name also needs to be normalised.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! This PR works 👍

I think it is better to normalize the name here. (cssFileName)

const cssFileName = ensureFileExt(cssAssetName, '.css')
if (chunk.isEntry && isPureCssChunk) cssEntryFiles.add(cssAssetName)
chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName)
chunkCSS = await finalizeCss(chunkCSS, true, config)
// emit corresponding css file
const fileHandle = this.emitFile({
name: isPreProcessor(lang) ? cssAssetName : cssFileName,

If you don't mind, I will push some changes since I'm using windows. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course not! Would love any input and help with this one.

Expand All @@ -118,7 +118,7 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {
if (chunk.type === 'chunk') {
manifest[getChunkName(chunk)] = createChunk(chunk)
} else if (chunk.type === 'asset' && typeof chunk.name === 'string') {
manifest[chunk.name] = createAsset(chunk)
manifest[normalizePath(chunk.name)] = createAsset(chunk)
}
}

Expand Down