Skip to content Skip to sidebar Skip to footer

Using Module "child_process" Without Webpack

I'm using Webpack to bundle dependencies, one of which is the emailing service postmark. This service depends upon something called child_process that apparently ships with node.

Solution 1:

Front-end developer of Postmark here.

It looks like you're trying to bundle postmark.js into your client-side JavaScript but https://github.com/wildbit/postmark.js is a Node.js library. This means it will not run in the browser and requires a running Node.js server.

The main reason for not supporting browser environment is security. As you can see in this example:

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

it requires you to insert the auth token. Bundling this with your client-side JS would expose it and allow everyone access your postmark account API.

Hope this clarifies it.

Post a Comment for "Using Module "child_process" Without Webpack"