Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V2] Parcel could not build sub-module in node_child.fork #4323

Open
zcmgyu opened this issue Mar 13, 2020 · 2 comments
Open

[V2] Parcel could not build sub-module in node_child.fork #4323

zcmgyu opened this issue Mar 13, 2020 · 2 comments

Comments

@zcmgyu
Copy link

zcmgyu commented Mar 13, 2020

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

🤔 Expected Behavior

child.js module is built in a separate file

😯 Current Behavior

child.js is not built

💁 Possible Solution

🔦 Context

I call the child.js process in a fork, but when to build with Parcel that child.js file is not found because it was not built.

💻 Code Sample

// index.js
const { fork } = require('child_process');

const forked = fork('child.js');

forked.on('message', (msg) => {
  console.log('Message from child', msg);
});

forked.send({ hello: 'world' });
// child.js
process.on('message', (msg) => {
  console.log('Message from parent:', msg);
});

let counter = 0;

setInterval(() => {
  process.send({ counter: counter++ });
}, 1000);
// package.json
{
  "name": "parcel-example",
  "version": "1.0.0",
  "license": "MIT",
  "main": "build/index.js",
  "scripts": {
    "build1": "PARCEL_WORKERS=0 parcel build index.js",
  },
  "dependencies": {
    "parcel": "^2.0.0-alpha.3.2"
  }
}

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-alpha.3.2
Node v12.16.0
npm/Yarn 1.22.0
Operating System macOS 10.15.3
@Kali95739
Copy link

I try to bundle this but I get fork is not a function any help @zcmgyu

@Kali95739
Copy link

I believe its my babelrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants