Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack asset module paths return 404 #56

Open
pixelpapercraft opened this issue Jul 4, 2021 · 0 comments
Open

Webpack asset module paths return 404 #56

pixelpapercraft opened this issue Jul 4, 2021 · 0 comments

Comments

@pixelpapercraft
Copy link

Hi @ryyppy

When using asset modules, such as this:

const logo = new URL("./logo.png", import.meta.url);

It generates a pathname such as /_next/9e8f58ab9ed5bb679a21.png, however this returns a 404 error for me.

After some investigation I found the output path for asset modules can be configured. I added the following to next.config.js:

config.output.assetModuleFilename = "static/images/[hash][ext][query]";

The generated pathname is now /_next/static/images/9e8f58ab9ed5bb679a21.png which displays successfully.

What do you think?

I'm happy to raise a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant