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.

How can I get the entry file name in the loaders?

See original GitHub issue

If I have a entry hello.js like this:

require('./images/test.png');

and I use file-loader to handle this, then I want the built image named as “hello.test.png”,how can I make it?

The following example can not fill my need:

{
  test: /\.(jpe?g|png|gif|svg)$/i,
  loaders: ['file?hash=sha512&digest=hex&name=[path][hash].[ext]']
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
wojohowitzcommented, Sep 1, 2016

recursive issue references here #1381 is pointing back to this one each citing a duplicate of the other 😃

10reactions
oleggromovcommented, Jan 17, 2017

Finally, guys, is there a way to get entry point name in a custom loader?

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack - How can I get the entry file name in the loaders?
I am writing a custom loader and need the ability to get the name of the entry file inside the loader. This question...
Read more >
file-loader - webpack - JS.ORG
Specifies a Regular Expression to one or many parts of the target file path. The capture groups can be reused in the name...
Read more >
长期缓存 | webpack
Webpack can add hashes for the files to the filename. Loaders that emit files (worker-loader, file-loader) already do this. ... entry output.
Read more >
Output - webpack 3 documentation
This option determines the name of non-entry chunk files. ... Automatic and explicit loaders and params up to the name of the first...
Read more >
Webpack: an introduction - ts - GUIDE - Angular
You supply Webpack with one or more entry files and let it find and ... pattern matches the filename, Webpack processes the file...
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