We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.
When referencing assets from an srcset attribute of img tags or from the image-set property, the image url is not transformed.
With this file :
<!-- index.html --> <img src="./image-test.jpeg" srcset="./image-test.jpeg 1x, ./image-test.jpeg 2x">
We have :
<!-- dist/index.html --> <img src="/assets/image-test.661b3be4.jpeg" srcset="./image-test.jpeg 1x, ./image-test.jpeg 2x">
We should have:
<!-- dist/index.html --> <img src="/assets/image-test.661b3be4.jpeg" srcset="/assets/image-test.661b3be4.jpeg 1x, /assets/image-test.661b3be4.jpeg 2x">
// styles.css .background-container { background-image: image-set( "./image-test.jpeg" 1x, "./image-test.jpeg" 2x ); }
// dist/assets/index.245668cc.css .background-container { background-image:image-set( "./image-test.661b3be4.jpeg" 1x, "./image-test.jpeg" 2x )}
We should have :
// dist/assets/index.245668cc.css .background-container { background-image:image-set( "/assets/image-test.661b3be4.jpeg" 1x, "/assets/image-test.661b3be4.jpeg" 2x )}
https://github.com/gnuletik/vite-srcset-import-playground
git clone https://github.com/gnuletik/vite-srcset-import-playground cd vite-srcset-import-playground npm run build cat dist/index.html
vite
/t/vite-project ❯❯❯ npm run build > vite-project@0.0.0 build > vite build --debug vite:config no config file found. +0ms vite:config using resolved config: { vite:config root: '/private/tmp/vite-project', vite:config base: '/', vite:config mode: 'production', vite:config configFile: undefined, vite:config logLevel: undefined, vite:config clearScreen: undefined, vite:config build: { vite:config target: [ 'es2019', 'edge16', 'firefox60', 'chrome61', 'safari11' ], vite:config polyfillDynamicImport: true, vite:config outDir: 'dist', vite:config assetsDir: 'assets', vite:config assetsInlineLimit: 4096, vite:config cssCodeSplit: true, vite:config sourcemap: false, vite:config rollupOptions: {}, vite:config commonjsOptions: { include: [Array], extensions: [Array] }, vite:config minify: 'terser', vite:config terserOptions: {}, vite:config cleanCssOptions: {}, vite:config write: true, vite:config emptyOutDir: null, vite:config manifest: false, vite:config lib: false, vite:config ssr: false, vite:config ssrManifest: false, vite:config brotliSize: true, vite:config chunkSizeWarningLimit: 500 vite:config }, vite:config inlineConfig: { vite:config root: undefined, vite:config base: undefined, vite:config mode: undefined, vite:config configFile: undefined, vite:config logLevel: undefined, vite:config clearScreen: undefined, vite:config build: {} vite:config }, vite:config resolve: { dedupe: undefined, alias: [ [Object] ] }, vite:config publicDir: '/private/tmp/vite-project/public', vite:config command: 'build', vite:config isProduction: true, vite:config optimizeCacheDir: '/private/tmp/vite-project/node_modules/.vite', vite:config plugins: [ vite:config 'alias', vite:config 'vite:dynamic-import-polyfill', vite:config 'vite:resolve', vite:config 'vite:html', vite:config 'vite:css', vite:config 'vite:esbuild', vite:config 'vite:json', vite:config 'vite:wasm', vite:config 'vite:worker', vite:config 'vite:asset', vite:config 'vite:define', vite:config 'vite:css-post', vite:config 'vite:build-html', vite:config 'commonjs', vite:config 'vite:data-uri', vite:config 'rollup-plugin-dynamic-import-variables', vite:config 'vite:import-analysis', vite:config 'vite:esbuild-transpile', vite:config 'vite:terser', vite:config 'vite:reporter' vite:config ], vite:config server: {}, vite:config env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true }, vite:config assetsInclude: [Function: assetsInclude], vite:config logger: { vite:config hasWarned: false, vite:config info: [Function: info], vite:config warn: [Function: warn], vite:config error: [Function: error], vite:config clearScreen: [Function: clearScreen] vite:config }, vite:config createResolver: [Function: createResolver] vite:config } +6ms building for production... ✓ 4 modules transformed. dist/assets/favicon.17e50649.svg 1.49kb dist/assets/image-test.661b3be4.jpeg 232.20kb dist/index.html 0.55kb dist/assets/index.245668cc.css 0.24kb / brotli: 0.15kb dist/assets/index.0fabbfdc.js 0.77kb / brotli: 0.37kb
The text was updated successfully, but these errors were encountered:
fix: should transform the img tag's srcset arrtibute and css' image-s…
0f17a74
…et property (#2188) fix #2177
Wooh that was fast ! Thank you !
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Describe the bug
When referencing assets from an srcset attribute of img tags or from the image-set property, the image url is not transformed.
With this file :
We have :
We should have:
With this file :
We have :
We should have :
Reproduction
https://github.com/gnuletik/vite-srcset-import-playground
System Info
vite
version: vite@2.0.1Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: