Describe the bug
As described in documentation:
|
::: 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.
Describe the bug
As described in documentation:
vite/docs/config/index.md
Lines 571 to 573 in 8b4075d
However, when look into source code:
vite/packages/vite/src/node/plugins/asset.ts
Lines 210 to 214 in 8b4075d
The code actually means "
build.assetsInlineLimitwill be ignored if you specifybuild.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.
If you specify
build.lib,build.assetsInlineLimitwill 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