Image is not defined
See original GitHub issueWhen I try to build my site using Poi, PostCSS and webp-in-css I get the following error:
./styles/footer.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Loading PostCSS Plugin failed: Image is not defined
(@/home/v1rtl/Desktop/Coding/v1rtl.site/.postcssrc)
at Array.map (<anonymous>)
As I understand this is because my site uses node.js environment and not browser one and that’s why Image
is not available. How I can fix this?
My .postcssrc
:
{
"plugins":
{
"precss": {},
"autoprefixer": {},
"webp-in-css": {},
"cssnano": {
"preset": "default"
}
}
One of styles that uses webp:
header {
display: flex;
align-items: center;
flex-direction: column;
user-select: none;
height: 100vh;
background-image: url('../assets/background.webp');
}
If you need to check all the files, repo is here
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ERROR: Image is not defined (trouble using Image() function)
But I receive this error: ERROR: 'Image' is not defined. [no-undef] about the part: var img = new Image(). I tried to replace...
Read more >Getting the "img not defined" reference error in the console
In "fetchBreedImage", a variable named "image" is defined; but references are made to "img", which is not defined.
Read more >Node.js new Image() is not defined · Issue #17 - GitHub
Browsers already have image manipulation built into them (because they need to do have a way to decode the images either way), node...
Read more >"image" is not defined in this scope - GIS Stack Exchange
'image' is not defined tells you the problem. You have not defined the image variable anywhere before you try to use it. You...
Read more >NameError: name 'image' is not defined - PsychoPy Discourse
Hello! I am trying to finish up my task. It is a quick detection task where the participant has to quickly identify if...
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
I renamed
index.js
topolyfill.js
to avoid this mistake in the future https://github.com/ai/webp-in-css/commit/e4f6959e6e3c151d694bdb1cd51c5c96bb707f34The fix was released in 0.3