The webpack
docs show the type to be return from configuration function , but not the types of the parameters env
and argv
. Currently I've to type them as any, however what are the actual types of env
and argv
?
const configuration = (env: any, argv: any): Configuration => ({
mode: 'production',
entry: './foo.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'foo.bundle.js',
},
...
});
They are both any
because they are both coming from the webpack cli arguments, so it is not possible to know the type in advance at compile time (unless you strictly know that you will always pass certain arguments and force the type to be what you declare it to be)
Webpack Environment Variables docs may help to understand better.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.