Skip to content

Generating the correct path for images #20

@dopeboy

Description

@dopeboy

(This is more a question around understanding and clarification rather than a proposal for a specific fix).

Going off this guide: is there a reason why a file-loader is not needed in the production webpack config?

When I don't include it and I use a require('.../img.png') in my application code, webpack correctly finds the image, renames it based on the hash, dumps it in the right place, and sets the path correctly. In other words, everything works OK.

Per all the documentation I've read on webpack, there are explicit recommendations to put the following in one's config file:

 module: { loaders: [ { ... { test: /\.(png|jpg)$/, loader: 'file-loader'} ], }, 

If I include the above, webpack generates another file that's either malformed or just some dummy stub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions