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
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
Share Improve this question edited Dec 16, 2018 at 19:26 Nikhil Kinkar 7819 silver badges31 bronze badges asked Aug 8, 2018 at 3:27 Diagathe JosuéDiagathe Josué 12.2k14 gold badges49 silver badges93 bronze badges1 Answer
Reset to default 2Have 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./twopluszero/next-images
const withImages = require('next-images')
module.exports = withImages(withCss())