简体   繁体   中英

node.js - does anyone know how to 'require()' external modules in _third_party_main.js

When using _third_party_main.js to extend node with your own script, when running your code in this context it seems that you can only require modules that are build in the node binary executable.

Am I doing something wrong?

For example, if you put your_stuff_file.js in root directory, just use require('./your_stuff_file.js'). Of course, your stuff must be referenced using module.exports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM