admin管理员组文章数量:1391934
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
}
}
版权声明:本文标题:javascript - how to add domains to next.config.js for "nextimage" while using a plugin - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744679395a2619307.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论