Skip to content

[Docs] Misunderstanding description of build.assetsInlineLimit #3643

Description

@Wzb3422

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationp1-choreDoesn't change code behavior (priority)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions