Importing from css results in `module.exports = "/_next/static/images..."`
See original GitHub issueImports in CSS files produce broken images. Not only SVG but at least JPEG too.
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:
- Created 4 years ago
- Comments:10 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
getting this same exact issue still 😕 even after implementing changes here