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: fileToBuiltUrl got undefined when file type is .ico #7106

Merged
merged 4 commits into from Feb 27, 2022

Conversation

poyoho
Copy link
Member

@poyoho poyoho commented Feb 27, 2022

Description

fix: #7083

Additional context

lukeed/mrmime#3

add own dictionary by directly assigning mrmine in assets plugin setup.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@@ -33,6 +33,9 @@ const emittedHashMap = new WeakMap<ResolvedConfig, Set<string>>()
export function assetPlugin(config: ResolvedConfig): Plugin {
// assetHashToFilenameMap initialization in buildStart causes getAssetFilename to return undefined
assetHashToFilenameMap.set(config, new Map())

// add own dictionary by directly assigning mrmine
mrmime.mimes['ico'] = 'image'
Copy link
Member

Choose a reason for hiding this comment

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

I think we should open an issue or PR to https://github.com/lukeed/mrmime first? @lukeed may be able to do a release quick enough so we don't need to patch.

Copy link
Member Author

Choose a reason for hiding this comment

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

lukeed/mrmime#3

That was an intentional part of the pkg design.

Copy link
Member

Choose a reason for hiding this comment

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

Would you add a comment with a link to that issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bluwy added 🙈

Copy link

Choose a reason for hiding this comment

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

ico is officially the image/vnd.microsoft.icon mime type and also has had image/x-icon recognized, but both are vendor-specific and/or experimental so mrmime does not include them. The image or image/icon solutions are all userland names and not officially true

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the reference @lukeed 👍🏼
IIUC, it would be better to use image/x-icon instead of image here

Copy link

Choose a reason for hiding this comment

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

Perhaps ya, but mrmime only contains the official mimes. Everything else is customizable

@patak-dev patak-dev merged commit 7a1a552 into vitejs:main Feb 27, 2022
@poyoho poyoho deleted the fix/ico-mrmime branch February 27, 2022 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mime type for .ico file is undefined
4 participants