question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing from css results in `module.exports = "/_next/static/images..."`

See original GitHub issue

Imports in CSS files produce broken images. Not only SVG but at least JPEG too.

image

next.config.js

const withOptimizedImages = require('next-optimized-images');
require('dotenv').config();

module.exports = withOptimizedImages({
  // next-optimized-images
  handleImages: ['jpeg', 'png', 'webp', 'svg'],

  // next
  env: {
    SITE_URL: process.env.SITE_URL,
  },
  webpack: config => {
    config.resolve.modules.push(__dirname);

    return config;
  },
});

Dependencies

 "next": "9.3.1",
 "next-optimized-images": "^2.5.5",
 "webp-loader": "^0.6.0"
 "imagemin-optipng": "^7.1.0",
 "imagemin-svgo": "^7.1.0",

Probbaly related to https://github.com/zeit/next.js/issues/11164

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
cyrilwannercommented, Jul 23, 2020

It has already been fixed within the currently published version on npm, so I’ll close this issue.

Also, I’m currently working on the next major version which is a complete rewrite and should resolve all other open issues (+ providing many new features). If you are interested, you can check out the canary branch.

1reaction
chrisLoPresticommented, May 21, 2021

getting this same exact issue still 😕 even after implementing changes here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using CSS Module Scripts to import stylesheets - web.dev
The default export of a CSS module script is a constructable stylesheet whose contents are those of the imported file.
Read more >
Next.js Global CSS cannot be imported from files other than ...
1 I modified it to change the export module like this. const nextConfig = { webpack: function(config){ config.module.rules.
Read more >
Understanding module.exports and exports in Node.js
In this article, I'll examine how to work with modules in Node.js, focusing on how to export and consume them. Different Module Formats....
Read more >
Understanding Modules and Import and Export Statements in ...
A module exports to provide code and imports to use other code. Modules are useful because they allow developers to reuse code, they...
Read more >
module.exports – How to Export in Node.js and JavaScript
In programming, modules are components of a program with one or more functions or values. These values can also be shared across the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found