rksm / paredit.js

Generic reader and editor for s-expressions.
MIT License
107 stars 21 forks source link

Node.js checks are wrong under Rollup #13

Closed anmonteiro closed 7 years ago

anmonteiro commented 7 years ago

Across paredit.js you check for typeof module !== "undefined" && module.require;

However, Rollup wraps commonJS modules with:

function createCommonjsModule(fn, module) {
    return module = { exports: {} }, fn(module, module.exports), module.exports;
}

which means module.require won't be available. I recommend checking for module.exports being available.

Happy to submit a PR!

anmonteiro commented 7 years ago

I think we also want to move the module.require calls to simply use require under Node.js so that they can be statically analyzed.