Saturday, 27 May 2017

Can't resolve module 'child_process'

I have an angular2 webpack project that is running in electron. I'm trying to use shelljs but webpack fails to build with the error:

[0] ERROR in ./~/shelljs/src/exec.js
[0] Module not found: Error: Can't resolve 'child_process' in 'D:\Projects\angular-electron\node_modules\shelljs\src'
[0]  @ ./~/shelljs/src/exec.js 6:12-36
[0]  @ ./~/shelljs/src ^\.\/.*$
[0]  @ ./~/shelljs/shell.js

My webpack configuration is targeting the electron-renderer and my polyfills are using zone-node:

return { 
    target: 'electron-renderer', //webpack-build-common.js
    ...

and

import 'zone.js/dist/zone-node'; //polyfills.ts

I have tried changing the webpack target to node but it has no effect.

You can see my entire webpack configuration on paste bin



via Camp bell

No comments:

Post a Comment