question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change /_next/webpack url of webpack 'file-loader'

See original GitHub issue

I’m using file loader like:

    // handle images
    config.module.rules.push({
      test: /\.(ico|gif|png|jpg|jpeg|svg|webp)$/,
      use: [
        {
          loader: 'emit-file-loader',
          options: {
            name: 'dist/[path][name].[ext]',
          },
        },
        {
          loader: 'file-loader',
          options: {},
        },
      ],
    });

Later on, I import files like:

import img from './someImg.png'

Resulting URL is like: /_next/webpack/ef89065b898bb1e3e802c62e4b264417.png and it works but it’s ugly 😃 Is it possible to customize it to make it more like /static/images/ef89065b898bb1e3e802c62e4b264417.png etc

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
glemierecommented, Apr 1, 2018

I fixed this problem in my nextjs starter. You can check the next.config.js file there. Any suggestion is welcomed btw.

0reactions
glemierecommented, Mar 29, 2018

@pie6k @arunoda I made a PR to correct the prefix in production. https://github.com/zeit/next.js/pull/4072

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change /_next/webpack url of webpack 'file-loader' #1926
I'm using file loader like: // handle images config.module.rules.push({ test: ... Change /_next/webpack url of webpack 'file-loader' #1926.
Read more >
file-loader - webpack - JS.ORG
The file-loader resolves import / require() on a file into a url and emits the file into the output directory. Getting Started. To...
Read more >
Configure file-loader options with Webpack 5 for Next.js
According to Asset Modules instruction I should change file-loader into type: 'asset/resource' . I wonder how I can satisfy options used in file...
Read more >
Next.js 5: Universal Webpack, CSS Imports, Plugins and Zones
From your perspective, all that changes is that an additional isServer property is passed to the decorator function above. However, the new ...
Read more >
How to add webpack loader to Next.js application
Changing the wepback configuration. Next.js abstracts away from us the webpack configuration. They leave a way to tweak it in our project, but ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found