Skip to content

Does not refer to the build assetInlineLimit settings from vite-plugin version 5. #1551

@hoiheart

Description

@hoiheart

Describe the bug

Hello.

Posting the vite-plugin version of my project to 5, I found some different behavior than before.

1. It does not follow the build assetsInlineLimit settings set in vite.config.ts.

I set assetsInlineLimit to 0, and if you import the image from *.css.ts and use it as a background, it will be applied as base64 data image unlike before.

2. Doublequote does not auto wrap when using the imported image.

If use svg, the base64 code is not valid and must wrap the doublequote.

import { style } from '@vanilla-extract/css';
import asset from './logo.svg';

export const logo = style({
  background: `url("${asset}") no-repeat 50% 50%`,// If use svg, the base64 code is not valid and must wrap the doublequote.
  // background: `url(${asset}) no-repeat 50% 50%`, ❌
});

I created a link to the sample codesandbox.
Please check vite.config.ts and App.css.ts.

Thanks.

Reproduction

https://codesandbox.io/p/devbox/vite-react-ts-forked-f5v63m

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC
    Memory: 2.05 GB / 4.14 GB
    Container: Yes
    Shell: Unknown
  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.8.1 - /usr/local/bin/npm
    pnpm: 8.10.2 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    @vanilla-extract/css: 1.17.0 => 1.17.0 
    @vanilla-extract/vite-plugin: 5.0.1 => 5.0.1 
    vite: ^2.2.3 => 2.3.3

Used Package Manager

yarn

Logs

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions