| 37 | process.on("SIGTERM", cleanProcess); |
| 38 | |
| 39 | function bundleNode(componentPath, fullBundlePath, basePath, bundlePath) { |
| 40 | return new Promise((resolve, reject) => { |
| 41 | const parameters = [componentPath, fullBundlePath, basePath, bundlePath]; |
| 42 | |
| 43 | const options = { |
| 44 | stdio: [0, 1, 2, "ipc"] |
| 45 | }; |
| 46 | |
| 47 | childProcess = fork(require.resolve("./bundleNode"), parameters, options); |
| 48 | // process doesn't exit in watch mode. |
| 49 | childProcess.on("message", data => { |
| 50 | resolve(); |
| 51 | }); |
| 52 | }); |
| 53 | } |
| 54 | |
| 55 | module.exports = bundler; |