global-paths.js 349 B

12345678910111213
  1. const Module = require('module');
  2. module.exports = (paths) => {
  3. const nodeModulePaths = Module._nodeModulePaths;
  4. Module.ignoreGlobalPathsHack = false;
  5. Module._nodeModulePaths = (from) => {
  6. if (Module.ignoreGlobalPathsHack) {
  7. return nodeModulePaths(from);
  8. } else {
  9. return nodeModulePaths(from).concat(paths);
  10. }
  11. };
  12. };