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

Support for Directory Output #91

Closed
serkolch opened this issue Sep 23, 2016 · 4 comments
Closed

Support for Directory Output #91

serkolch opened this issue Sep 23, 2016 · 4 comments

Comments

@serkolch
Copy link

For reasons outside my control, we have a single webpack output path to a directory (e.g. app/scripts) - I can't do multiple configs for different entries / modules.

I'm using file-loader to hash images. Ideally, they'd end up in a folder outside of scripts (e.g. app/static), so I've used:

module: {  
    loaders: [  
        {  
            test: /\.(png|jpg|jpeg|gif|svg)$/,  
            loader: "file?name=../static/[md5:hash:hex:8][name].[ext]"
        }  
    ]  
}  

This creates the hashed images into the correct directory, but upon requiring the image files, the html shows the '../static' in the src:

<img src="../static/131ddf32imagefile.png>

Is there support for file-loader to choose the output directory? I've tried overwriting that with public path, but it just prepends the public path value to "../static".

@serkolch
Copy link
Author

Conversely, is this something that could be solved by passing a function in as the publicPath? How would that be done?

@shri3k
Copy link

shri3k commented Oct 21, 2016

I'm running into the same issue too. It's great if your site actually hosts static files in /static and you actually have /static directory which works nicely but if it's other than /static like say /public or just / (default in express) then you'll be forced to host your static files in root or create a directory that plays well with just how file-loader creates directory.

Edit:- I just found out that there was already an on-going discussion of supporting this on #81

@alexander-akait
Copy link
Member

@serkolch Is the problem still there? Did comment #91 (comment) solved your problem? If not please create minimum reproducible test repo, thanks!

@michael-ciniawsky
Copy link
Member

Fixed by #81

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

No branches or pull requests

4 participants