Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Add [id] placeholder support for name property #176

Closed
devrafalko opened this issue Jul 2, 2017 · 2 comments
Closed

Add [id] placeholder support for name property #176

devrafalko opened this issue Jul 2, 2017 · 2 comments

Comments

@devrafalko
Copy link

Lets assume that I use file-loader this way:

{
  test: /\.html$/,   
  loader: 'file-loader',
  options:{
    name: "[name].[ext]",
    outputPath: 'dist/'
}

When I have got 2 entry points of the same name, but in different directories, eg.

  • src/componentA/template.html
  • src/componentB/template.html

and want to emit them as separate chunks to my dist folder, the one file overwrites another file and it is not desirable behaviour.

I can of course change name property for name:[name][hash].[ext] and it does the trick, but I just want to separate files of the same names, not to solve cache problems and what's more, if I emit eg. .html files as in the example and use dev-server, it emits new hashed .html file on every build (when I edit html files) what is not recommended as mentioned in this webpack-dev-server issue.

The [id] placeholder indicating the number of the chunk would be the best way to get what I want. The output.filename and extract-text-webpack-plugin supports [id] for example. Would it be possible to add [id] placeholder support or maybe there's any other solution of my problem?

@michael-ciniawsky
Copy link
Member

[path] ?

@michael-ciniawsky michael-ciniawsky changed the title file-loader [id] placeholder support for name property Add [id] placeholder support for name property Jul 28, 2017
@alexander-akait
Copy link
Member

@devrafalko Thanks for issue! Duplicate #114

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

No branches or pull requests

3 participants