Webpack and TypeScript: Cannot resolve module 'child_process' in node.d.ts Webpack and TypeScript: Cannot resolve module 'child_process' in node.d.ts typescript typescript

Webpack and TypeScript: Cannot resolve module 'child_process' in node.d.ts


All you're missing is a key target: 'node'.

This makes sure that the environment you are targeting is Node.js and not the browser, and will therefore ignore native dependencies.

Final Config:

module.exports = {    entry: './ui/index.ts',    target: 'node',    output: {        path: __dirname + '/build-ui',        filename: 'app.js',        publicPath: 'http://localhost:8090/assets'    },    module: {        loaders: [            {                test: /\.jsx$/,                loader: 'jsx-loader?insertPragma=React.DOM&harmony'            },            {                test: /\.css$/,                loader: "style-loader!css-loader"            },            {                test: /\.scss$/,                loader: "style-loader!css-loader!sass-loader"            },            {                test: /\.(png|jpg)$/,                loader: 'url-loader?limit=8192'            },            {                test: /\.ts$/,                loader: 'awesome-typescript-loader'            }        ]    },    resolve: {        extensions: ['', '.js', '.jsx', '.ts']    }};