Skip to content

Commit a3dd7b3

Browse files
committed
fix: 🐛 Processing when the image component is not used
Closes: #195
1 parent 0c07d3d commit a3dd7b3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cli/index.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,13 @@ export const run: Run = ({ customManifestJsonPath, noCache = false }) => {
227227
const config = getConfig()
228228
const manifestJsonPath = path.resolve(cwd, customManifestJsonPath ?? '.next/custom-optimized-images.nd.json')
229229

230-
optimizeImages({ manifestJsonPath, noCache, config })
230+
if (fs.existsSync(manifestJsonPath)) {
231+
optimizeImages({ manifestJsonPath, noCache, config })
232+
} else {
233+
// eslint-disable-next-line no-console
234+
console.log(
235+
colors.bold.magenta(`\nNo images were found to optimize.
236+
(Maybe you never used the image component.)`)
237+
)
238+
}
231239
}

0 commit comments

Comments
 (0)