Comments (2)
This is unfortunately not possible out of the box with the current version. But the next major version of this plugin (which I'm currently working on) will use the same asset prefix as next does, so this will work in the future.
Until then, you can achieve the same with a bit more manual setup if you want to.
You could create a new file (e.g. images-prefix.js
) which stores and exports the prefix in a variable and exposes a function to set this variable.
Then, everywhere you use an image, you can prefix the src with this variable, e.g.
<img src={imagesPrefix + require('./image.png')}>
. Of course, you could also create a wrapper component which adds this prefix automatically for every image.
from next-optimized-images.
hey @cyrilwanner has this been fixed? I'm trying canary.10 but it looks like it's not working when using the or component. Also src property type does not allow to concatenate the prefix.
from next-optimized-images.
Related Issues (20)
- Create an example in Next.js /examples folder
- Image is not getting compressed in my NEXT app HOT 2
- imagemin-svgo version 10.0.0 compatibility
- Bump sharp to v0.29.0 HOT 2
- Error: Input buffer contains unsupported image format HOT 1
- Error: Objects are not valid as a React child HOT 1
- require() of ES Module (.\node_modules\imagemin-svgo\index.js) from (.\node_modules\next-optimized-images\lib\loaders\img-loader.js) not supported. HOT 3
- Next 12 - got next dev, next build and next export to work - update documentation HOT 1
- images that copied into the static folder(/_next/static/media/*) are damaged HOT 9
- Problem when using next.js github pages template + next-optimized-images
- Dynamic urls not supported
- Support for imagemin-mozjpeg v10 HOT 2
- .svg?sprite are included in client side bundle
- Images within client-side-only loaded components arenβt optimized HOT 1
- TypeError: unsupported file type: undefined (file: undefined) HOT 5
- Warning from nextjs when optimizeImages and inlineImageLimit are used HOT 2
- Compatible with Next 13? HOT 2
- kgroundimage using in reactjs
- image optimization issue
- add support for svg components
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 next-optimized-images.