This is my current setup.
// next.config.js
const withImages = require("next-images");
module.exports = withImages({
webpack(config, options) {
return config;
},
});
I want to add this code to allow images from the domain localhost:3001
.
images: {
domains: ['localhost:3001'],
},
This is my current setup.
// next.config.js
const withImages = require("next-images");
module.exports = withImages({
webpack(config, options) {
return config;
},
});
I want to add this code to allow images from the domain localhost:3001
.
images: {
domains: ['localhost:3001'],
},
Share
Improve this question
edited Apr 14, 2021 at 23:25
juliomalves
50.6k23 gold badges178 silver badges169 bronze badges
asked Mar 31, 2021 at 23:59
OmarOmar
3,4213 gold badges24 silver badges41 bronze badges
2 Answers
Reset to default 4You simply have to add the images
object to the config object passed to withImages
.
// next.config.js
const withImages = require("next-images");
module.exports = withImages({
images: {
domains: ['localhost:3001']
},
webpack(config, options) {
return config;
}
});
I think you shoud set assetPrefix, read Options in the docs
// next.config.js
const withImages = require('next-images')
module.exports = withImages({
assetPrefix: 'https://example.',
dynamicAssetPrefix: true,
webpack(config, options) {
return config
}
}