#Opt out of using next/image for image files in `import` statements?

4 messages · Page 1 of 1 (latest)

slim fulcrum
#

I have a project where next/image provides little value, but would like to bundle some SVG files. By default imports yield something with any type, and the helpful message "Use any to avoid conflicts with @svgr/webpack plugin or babel-plugin-inline-react-svg plugin." This is not expected or desired behavior. In fact I would rather use one of the the plugins being avoided! The returned object does have a property with a packed url for the image, but it feels really unstable/hacky to use an undocumented property on an any object.

Does anyone have any experience modifying the webpack configruation? Are we even still using webpack?

hidden brambleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
slim fulcrum
#

It looks like webpack is still in the tech stack! Removing any loaders configured to use next-image seems like a good start!

/** @type {import('next').NextConfig} */
const nextConfig = {
    webpack:(config, options) =>{
        config.module.rules=config.module.rules.filter (rule=>!rule?.loader==='next-image-loader')
        return config;
    }
}
slim fulcrum