Comments (11)
It was a simple stupid typo in the include patterns lol π
The fixed version should be pushed to rpm in a couple of minutes
from imagetools.
Hey thanks for your feedback!
How do you import your image? (In the template,or script part?)
I'm aware of a couple of problems that I'm actively trying to solve at the moment (will be published as version 3 soon hopefully).
Currently importing images involves a lot of fighting vite, sadly.
For example importing images in css does not work at all because the import never gets relayed to plugins.
You can however try to import your image in the script section of your component and use it as a variable.
from imagetools.
This is how I import it:
// @ts-ignore
import image from "./images/01.jpeg?format=webp";
import Work from "../../../src/type/Work";
const work01: Work = {
slug: "work-01",
title: "Work 01",
image,
};
export default work01;
from imagetools.
This is how the output of vite build
looks like:
And this is how the image looks in network tab:
from imagetools.
That's strange it really seems like the plugin is not catching the import at all, what does your vite config look like?
from imagetools.
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";
import imageTools from "vite-imagetools";
export default defineConfig({
plugins: [
imageTools(),
solidPlugin()
],
build: {
target: "esnext",
polyfillDynamicImport: false,
},
});
from imagetools.
So I've just created a few test cases with the vitejs create-app vue-ts and preact-ts templates importing images in a couple different way and I cannot reproduce your bug, I can only suspect that it's an issue with the solid plugin.
Can you confirm that this issue still exists when swapping the order of the plugins?
i.e.
plugins: [
solidPlugin(),
imageTools()
],
instead of
plugins: [
imageTools(),
solidPlugin()
],
from imagetools.
It still exists
from imagetools.
Ohhhhh... I think I found it, can you try renaming your file from .jpeg
to .jpg
? I might have forgotten to alias jpeg to jpg π
I'll push a fix for that asap though
from imagetools.
Hell yeah now it's working!
from imagetools.
π This issue has been resolved in version 2.3.3 π
The release is available on:
Your semantic-release bot π¦π
from imagetools.
Related Issues (20)
- Query strings don't work in dynamic imports with template literals containing variables HOT 8
- Upgrading to Vite 4.4.0 broke vite-imagetools HOT 5
- imagetools-core 4.0.4 `resolveConfigs` behavior change, `format` directive no longer working
- Build and build -w output differs HOT 6
- as=source and as=srcset both outputting srcset with all the same width params HOT 3
- manifest.json is generated incorrectly HOT 2
- Upgrading Vite-imagetools 5.0.8 throws an error from 4.x version HOT 2
- generateImageID causes tests to fail on CI HOT 3
- Vite example has a typo HOT 1
- Renaming picture fallback to img is not reflected in the document HOT 1
- Waste less effort transforming images
- Dependency on sharp not declared correctly for yarnβs PnP loader HOT 9
- Vite plugin crash HOT 2
- Loading attribute HOT 1
- v6 broken due to missing sharp 0.33 binariers HOT 3
- Some images get rotated for some reason HOT 14
- crop from / "gravity" HOT 1
- Error: Unable to parse color from string: ##ffaa22
- Pre-transform error: Failed to parse source for import analysis because the content contains invalid JS syntax
- How to receive access to original image in `extendOutputFormats` after v7.0.0? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagetools.