twopluszero / next-images

Import images in Next.js (supports jpg, jpeg, svg, png and gif images)
MIT License
948 stars 67 forks source link

next-image config with @zeit/next-css #25

Closed zahraHaghi closed 4 years ago

zahraHaghi commented 4 years ago

hello .my next.config file is

const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');

module.exports = withCSS(withSass());

I installed next-image and added it to config:

const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');
const withImages = require('next-images');

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

but I got this error

./node_modules/react-modern-calendar-datepicker/lib/DatePicker.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> .DatePicker {
|   position: relative;
|   display: inline-block;

how can I resolve this problem?

arefaslani commented 4 years ago

@zahraHaghi Sorry for the late reply, you should also embed the withImages function call as withCSS and withSass. Something like this:

const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');
const withImages = require('next-images');

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

You also can use next-compose-plugins.