saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.69k stars 215 forks source link

Nextron support for images.remotePatterns originally from next.config.js (Next.js) #392

Closed bm777 closed 10 months ago

bm777 commented 10 months ago

How can I configure the external image URL source as we do in next.js (next.config.js) as following:

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: false,
  images:{
    remotePatterns: [
      {
        protocol: "https",
        hostname: "**"
      }
    ],
    minimumCacheTTL: 15000000,
  }
}

module.exports = nextConfig

This is the content I have in my next.config.js

module.exports = {
  webpack: (config, { isServer }) => {
    if (!isServer) {

    }

    return config;
  },
};
AbdeenM commented 10 months ago

Try the following package versions:

    "electron": "^21.4.4",
    "nextron": "^8.5.0",
    "next": "13.4.12",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",

Its abit tricky because support for next 13 and electron 22+ is not yet available on nextron but i have remotepatterns working for me with these versions.

You can also checkout this repo for an example, but i couldnt get it working tho

bm777 commented 10 months ago

@AbdeenM Thanks for your reply.

I found a solution without changing my current package version. I only have to add domains outside of the webpack function like this and it works.


module.exports = {
  images: {
    domains: ["lh3.googleusercontent.com"]
  },
  webpack: (config, {isServer, defaultLoaders}) => {
    if (!isServer) {

    }
    return config

  }
}