2

I'm working with NextJS and I'm trying to custom my configuration. So far, I have tried to add CSS support + files support.

Here my next.config.js :

const webpack = require("webpack");  
const withCSS = require('@zeit/next-css');


module.exports = withCSS({

  webpack : (config, { dev }) => {
    config.module.rules.push({
            test: [/\.svg$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
            loader: "file-loader",
            options: {
              name: "public/media/[name].[ext]",
              publicPath: url => url.replace(/public/, "")
            }
          });
    return config;
  } 
})

my console returns me :

UnhandledPromiseRejectionWarning: Error: Chunk.entrypoints: Use Chunks.addGroup instead

I can't figure out what fails.

If anybody have an hint, would be great,

Thanks

1 Answer 1

2

Have you tried wrapping it in other ways? This might work (not 100%):

module.exports = (config, { dev }) =>{
config.module.rules.push({
        test: [/\.svg$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
        loader: "file-loader",
        options: {
          name: "public/media/[name].[ext]",
          publicPath: url => url.replace(/public/, "")
        }
      });
return withCss(config);

} }

Also there is a withImages wrapper, https://github.com/twopluszero/next-images

const withImages = require('next-images') 
module.exports = withImages(withCss())
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.