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

[Docs] Misunderstanding description of build.assetsInlineLimit #3643

Closed
6 tasks done
Wzb3422 opened this issue Jun 2, 2021 · 2 comments · Fixed by #3672
Closed
6 tasks done

[Docs] Misunderstanding description of build.assetsInlineLimit #3643

Wzb3422 opened this issue Jun 2, 2021 · 2 comments · Fixed by #3672
Labels
documentation Improvements or additions to documentation p1-chore Doesn't change code behavior (priority)

Comments

@Wzb3422
Copy link

Wzb3422 commented Jun 2, 2021

Describe the bug

As described in documentation:

vite/docs/config/index.md

Lines 571 to 573 in 8b4075d

::: tip Note
Assets will **always** be inlined, regardless of file size, and `build.assetsInlineLimit` will be ignored if you specify `build.lib`
:::

However, when look into source code:

if (
config.build.lib ||
(!file.endsWith('.svg') &&
content.length < Number(config.build.assetsInlineLimit))
) {

The code actually means "build.assetsInlineLimit will be ignored if you specify build.lib, and ONLY IN THIS CONDITION assets will always be inlined, regardless of file size".

Hence, the description in documentation is a misunderstanding, the order of the sentence should be corrected.

  • A possible translation:
    If you specify build.lib, build.assetsInlineLimit will be ignored and assets will always be inlined, regardless of file size.

Reproduction

https://vitejs.dev/config/#build-assetsinlinelimit

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

Used package manager:

Logs


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

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
@Wzb3422 Wzb3422 changed the title Misunderstanding description of build.assetsInlineLimit [Docs] Misunderstanding description of build.assetsInlineLimit Jun 2, 2021
@Shinigami92 Shinigami92 added documentation Improvements or additions to documentation p1-chore Doesn't change code behavior (priority) and removed pending triage labels Jun 2, 2021
@Wzb3422
Copy link
Author

Wzb3422 commented Jun 2, 2021

vitejs/docs-cn#138

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation p1-chore Doesn't change code behavior (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants