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

feat: add .pdf to list of known asset types #4752

Merged
merged 1 commit into from Aug 27, 2021

Conversation

brillout
Copy link
Contributor

Description

Add .pdf files to know asset types, so that Vite users can simply import myDocUrl from './path/to/myDoc.pdf' instead of having to append ?url.

Additional context

NA.

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.

Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

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

Emmm, I guess it's ok to have it, even tho I want to against this.

Maybe we can set a rule for what to be included and what not, trying to keep the list not explode in future PRs.

The one that comes my mind is that, since Vite is a frontend tooling, maybe we can say assets that browsers understand (so images, video, audio, fonts, ... and pdf 😅). So, LGTM 😄

Copy link

@ericdfields ericdfields left a comment

Choose a reason for hiding this comment

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

In my case, I was embedding a PDF in an iframe and ran up to this.

Most browsers give you a minimum amount of tools for PDFs when embedded via iframe. It still works remarkably well.

I agree that you wouldn't want the list to get terribly long, but I don't think there are too many other even unlikely embeds like PDF

Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

I also think this is fine, we can wait if you want to discuss with the team the rule before merging but it would be quite strange to me if we end up leaving pdf out.

@antfu antfu merged commit d891641 into vitejs:main Aug 27, 2021
@patak-dev
Copy link
Member

We discussed this with the team. Unless video or image, we should push for the use ?url or assetsInclude option. We can leave pdf in, but I think we are going to try to avoid adding other file formats in the near future

aleclarson pushed a commit to aleclarson/vite that referenced this pull request Nov 8, 2021
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.

None yet

4 participants