Ebdulmomen1
Ebdulmomen1

Reputation: 703

next-images and next-videos are not working properly

In my next.js application I'm using next-images, next-videos to import the local videos.

this is my configuration in next.config.js file

const withCSS = require('@zeit/next-css')
module.exports = withCSS();

const withImages = require("next-images");
module.exports = withImages();

const withVideos = require('next-videos')
module.exports = withVideos();

my problem here is that whichever of the two modules being loaded the latest one will work and the former one won't

for example in the case of above the video files will be loaded successfully but the images won't and it throws an error saying that there is not an appropriate configured loader for this type of file, and if i change the order of importing the two modules this time the images will be loaded and the videos won't.

can someone help me understand what is going on?

Upvotes: 2

Views: 2922

Answers (1)

Ebdulmomen1
Ebdulmomen1

Reputation: 703

I combined all the exports into one export and now its working

const withImages = require("next-images");
const withCSS = require('@zeit/next-css')
const withVideos = require('next-videos')


module.exports = withCSS(withImages(withVideos()));

another and a better way to do it is to use next-compose-plugins as stated by ddon-90 in this thread

How to combine and use multiple Next.js plugins

Upvotes: 2

Related Questions