javascript - Using module "child_process" without Webpack -


i'm using webpack bundle dependencies, 1 of emailing service postmark. service depends upon called child_process apparently ships node.

the problem is, when attempt run webpack bundle app, complains:

module not found: error: cannot resolve module 'child_process' in ...

most of answers online that, in response error, should add line:

  node: {     child_process: 'empty'   } 

to webpack config. makes no sense, because webpack doesn't try child_process, , consequently, when run app, following error:

uncaught typeerror: exec not function

which error postmark (the service relies upon child_process) complaining exec function within child_process module doesn't exist.

thus, i'm wondering how can include child_process module in build without webpack complaining?

front-end developer of postmark here.

it looks you're trying bundle postmark.js client-side javascript https://github.com/wildbit/postmark.js node.js library. means not run in browser , requires running node.js server.

the main reason not supporting browser environment security. can see in example:

var postmark = require("postmark"); var client = new postmark.client("<server key>"); 

it requires insert auth token. bundling client-side js expose , allow access postmark account api.

hope clarifies it.


Comments