How to capitalize the first letter of the webpack output option [name]

for example, my entry file is input.js, then [name] is input,. Now I want to generate such an output:"xxInput.js",. I tried to write a function firstUpperCase, with uppercase letters by myself, and then output: xx$ {firstUpperCase ([name])} , I reported an error when packing, so how should I write it?

May.14,2021

your way of writing is literal, and webpack doesn't know it.

output.filename can also pass parameters of type function, for example:

output: {
    filename: function(chunkData){
        //  chunkData.chunk.name 
        return 'whatever.[name].js'
    }
}

{
    entry:{
        xxInput:'/path/to/input.js'
    }
}
Menu