sync.js 606 B

123456789101112
  1. var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
  2. var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD');
  3. var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD');
  4. console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
  5. console.log(b, ': preserveSymlinks true');
  6. console.log(c, ': preserveSymlinks false');
  7. if (a !== b && a !== c) {
  8. throw 'sync: no match';
  9. }
  10. console.log('sync: success! a matched either b or c\n');