Reputation: 565
I've been trying to wrap my head around webpack. I have a really hard time digesting it. I can't tell you how many tutorials I've read. I went through nearly all of them on their website. Read the docs section twice. I've watched video tutorials on lynda and youtube. Been struggling with it for nearly a week. I still can't understand most of it.
So just for the heck of it, let's say I want to process a set of images. There's no project, there are no modules, javascript or nothing. I just want to process the images. Why? No reason. Just to get to understand how webpack works and play around with the config file in various ways trying to understand it.
With that said, all I want to do is move a set of images from the 'app/img' folder to the 'build/img' folder, and maybe incorporate the hash in the file name. Eg:
module.exports = {
entry: {
entry: ''
},
output: {
path: 'build',
filename: ''
},
module: {
loaders: [
{
test: /\.(png)$/,
loader: 'file?name=img/[name]-[hash].[ext]',
include: './app/img/'
}
]
}
};
Since there's no js file to output (hence I just want to images to be process), there's no entry for 'entry' and 'output' - or at least I'm not sure what to put there.
How would I go about doing this? Because as it stands, this config files is not correct, but I have no idea how to make it work. Thanks.
PS: I have the file-loader package downloaded, which I'm trying to use for this.
Upvotes: 0
Views: 317
Reputation: 16029
Webpack is more bundler than task runner like gulp or grunt. You are trying develop simple copy task with rename files - this is not how you should use Webpack.
loaders
will be fired only when test
scenario will match path in require
or import
. So since you don't have any importing statements your loader never be used.
Upvotes: 1