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

ParseError: child_process #41

Closed
derrickb opened this issue Oct 10, 2019 · 2 comments
Closed

ParseError: child_process #41

derrickb opened this issue Oct 10, 2019 · 2 comments

Comments

@derrickb
Copy link

Hi there,

My bundled file ends up running in an environment that has access to node modules. In one of my modules I have:
let spawn = require('child_process').spawn;

When running nollup -c I get this error:

ParseError: child_process
Error: ENOENT: no such file or directory, open 'child_process'
    at parse (/node_modules/nollup/lib/index.js:93:23)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

I've tried setting preferBuiltins to both true and false in the node resolve plugin options, but neither works.

Is this something that can be fixed?

@PepsRyuu
Copy link
Owner

PepsRyuu commented Oct 10, 2019

Can you show me your rollup.config.js?

Have you tried using global.require or using an alias for require instead?

Here's an example of using native require in an Electron app: https://github.com/PepsRyuu/mocha-istanbul-ui/blob/master/src/ext/CoverageInstrumenter.js

@derrickb
Copy link
Author

Using global.require worked! Thank you

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

No branches or pull requests

2 participants