Replies: 4 comments 4 replies
-
I'm also having this issue. |
Beta Was this translation helpful? Give feedback.
-
Ran across this issue and went down the rabbit hole of debugging... The webpack configuration that is created by nextjs uses the global Webpack will use So now, my question is whether this is a nextjs bug or a webpack bug. IMO, I believe this is a webpack bug. Setting options for Anyways, for now, I have this in my nextjs webpack config to unblock me:
There's probably a cleaner way to handle that, but it is good enough for now for me. |
Beta Was this translation helpful? Give feedback.
-
This problem still remains in Next.js 13 (13.0.4 as of writing) I also wanted to use I tried using @timothympace's solution in my webpack(config, context) {
config.module.rules.push(
// rule for inlining bitmap images with the query parameter ?inline (e.g. test.png?inline)
{
test: /\.png/,
type: 'asset/inline',
resourceQuery: /inline/,
},
);
// workaround for Next.js overriding webpack `config.module.generator` which breaks asset/inline
// https://github.com/vercel/next.js/discussions/36981#discussioncomment-3167331
config.module.generator['asset/resource'] = config.module.generator['asset'];
config.module.generator['asset/source'] = config.module.generator['asset'];
delete config.module.generator['asset'];
return config;
}, but the output is always a base64 of some metadata, not the actual image file. For example I was seeing
which is actually this decoded
EDIT: Turns out this is because the |
Beta Was this translation helpful? Give feedback.
-
I'm also having trouble with |
Beta Was this translation helpful? Give feedback.
-
Verify canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Home
Binaries:
Node: 16.14.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 17.0.2
react-dom: 17.0.2
warn - Latest canary version not detected, detected: "12.1.6", newest: "12.1.7-canary.6".
Please try the latest canary version (
npm install next@canary
) to confirm the issue still exists before creating a new issue.Read more - https://nextjs.org/docs/messages/opening-an-issue
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
When add a webpack configuration
I get error when try to build:
Expected Behavior
Build will be executed sucessfuly with import images in the base64
To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions