webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 257 forks source link

how to get chunk name #325

Closed joey-lucky closed 5 years ago

joey-lucky commented 5 years ago

Code

{
    test: /\.(jpe?g|png|gif|svg)$/,
    loader: "file-loader",
    options: {
        outputPath: function () {
            console.log(Array.prototype.splice.call(arguments));
            return ""
        },
        publicPath: function () {
            console.log(Array.prototype.splice.call(arguments));
            return publicPath
        },
        name: function (chunkData) {
            console.log(Array.prototype.splice.call(arguments));
            return "image/[hash].[ext]";
        }
    },
}

all this function has no arguments

alexander-akait commented 5 years ago

No way, it is module build step, webpack doesn't know chunk in this state