Cannot use .png files from a monorepo Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders #25752
Replies: 1 comment
-
|
Has anyone found a solution? Facing the same problem after upgrading from Next 10.2.3 to 11.1.1 and removing import myPng from "./local/path/to/my.png";
<img src={myPng} />If I keep If I remove Upgrading to Next 12 is not an option at this point because we rely on Webpack 4 (not sure if this would fix the issue). UPD: Solution 👀 Inspired by https://www.npmjs.com/package/next-images#typescript
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Next.js are you using?
10.2.2
What version of Node.js are you using?
v12.13.0
What browser are you using?
Chrome
What operating system are you using?
Ubuntu 18.04.5 LTS
How are you deploying your application?
Vercel
Describe the Bug
I am using a monorepo inside which I have a nextjs app that uses components from a shared folder. The problem is that in the shared folder I have also images that when I want to used them inside my nextjs app is breaking
../components/src/assets/images/paymentBrands/visa.png Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loadersThe file structure is:
Expected Behavior
Images should be loaded as expected
To Reproduce
babel.config.js
next.config.js
Beta Was this translation helpful? Give feedback.
All reactions