twopluszero / next-images

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

How to import CDN delivered images? #45

Closed abhijit-hota closed 3 years ago

abhijit-hota commented 4 years ago

This is what my current next.config.js looks like.

const withImages = require('next-images')
module.exports = withImages({
  assetPrefix: 'https://cdn.jsdelivr.net/npm/simple-icons@v3/icons',
  webpack(config, options) {
    return config
  }
});

As mentioned, I'm using the assetPrefix option.

But how do I import it in different pages and components? I've tried with src={require(/css3.svg)} but it doesn't work.

arefaslani commented 4 years ago

Will get fixed after merging this PR: https://github.com/twopluszero/next-images/pull/44