Comments (10)
Hi @kevincarld,
Could you please explain the use case of "./" instead of "/" to me? Can you share an example of how you are using the ExportedImage component?
from next-image-export-optimizer.
Hi @Niels-IO , actually I think I just have the same issue as the other comments. Because the static site im exporting won't be in the root directory that's why image src's are having issue
from next-image-export-optimizer.
Can this be reopened? My images are not found after proper export:
Code:
import logo from "public/images/logo.png";
...
<ExportedImage src={logo} style={{height: "100%", width: "auto"}}
alt="Faces in front of each other"/>
package.json
"build:docker": "next build && next export -o .export && next-image-export-optimizer --exportFolderPath .export",
DockerFile:
WORKDIR /app/clientApp
COPY --from=builder /opt/app/.export ./
It seems like the path should be under images
?
from next-image-export-optimizer.
Actually, the name is wrong:
Should be logo-opt-10.WEBP
Not logo.bc950706-opt-10.WEBP
Any idea why this random identified is added?
from next-image-export-optimizer.
Hi @Rashair,
After you run the command "build:docker", you should see a folder called nextImageExportOptimizer inside the .export folder. (I confirmed with the example app in this module that this is correctly working).
Then the URL in the browser would resolve as the images are stored in the nextImageExportOptimizer folder, which is indeed at the root level. The random hash is actually created by next.js as you have used statically imported images, and this is how they handle it. As the srcset uses the images with the added hash and the images in the folder nextImageExportOptimizer are named accordingly, everything matches.
Where are the optimized images placed if you run the build:docker command?
from next-image-export-optimizer.
There only under 'images' - nowhere else. The nextImageExportOptimizer folder does not appear. I've also tried on your example app and it works locally for me there, but not in my own app :/
from next-image-export-optimizer.
I think the issue is with the statically imported images - other seem to work
from next-image-export-optimizer.
Hi @Rashair,
I am currently a little bit clueless about how to help you further. Could you create a minimal example that reproduces the error?
from next-image-export-optimizer.
I think I found the issue - I have a custom distDir
, it's .build
, not .next
.
Here's a reproduction using your example:
https://github.com/Rashair/next-image-export-optimizer-78
(The reproduction only works on the clean repo - if you don't have .next dir there, otherwise it will supposedly copied from there)
from next-image-export-optimizer.
Hi @Rashair,
Thank you very much! This is indeed the issue, and I found an easy fix. I will release it in the next patch version.
from next-image-export-optimizer.
Related Issues (20)
- Package wont install on NPM with Next 14 HOT 1
- Using remote SVGs HOT 1
- Feature request: Don't download again for X days HOT 4
- process.env.nextImageExportOptimizer_storePicturesInWEBP assumed to be boolean HOT 1
- Next.js 14 dev mode error HOT 2
- Images that dont have predefined height HOT 8
- SVG optimization with tools like svgo HOT 2
- Can't optimize two different path HOT 1
- unexpected property: transpilePackages HOT 4
- Srcset not created for Static Images HOT 28
- Output folder not being created on build. HOT 12
- Add support for Picture element HOT 1
- Issue with query string get params HOT 2
- Could not load sharp module error HOT 2
- Export utilities from ExportedImage component HOT 1
- Allow setting location of the hashes.json and optimized images
- Add `unoptimized` configuration option
- Adding custom options when fetching remote images HOT 4
- Doesn't work on next 14.1 HOT 2
- Remote image download error: `ENAMETOOLONG: name too long` HOT 3
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-image-export-optimizer.