I saw, when searching, that there are typings for webpack. So it seems I can write webpack.config.js in typescript? But how can I do that?
If you do not want to transpile your webpack config and then pass it to webpack script in two steps I came up with other solution. Using webpack programmatically is really easy, so I have created a build script build.ts
import webpack from 'webpack'
import config from './webpack.config'
webpack(config, (err, stats) => err
? console.log(err)
: console.log(stats)
);
Then you may run npm script with ts-node like so
"build": "ts-node --project ./path-to/tsconfig.json ./build.ts"