SHARE
TWEET

Untitled

a guest Jun 17th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require('babel-register');
  2. require('./src/app.js');
  3.      
  4. import package from 'package';
  5. ...
  6.      
  7. #!/usr/bin/env node
  8. require('../bootstrap.js');
  9.      
  10. appdir$ ./bin/myapp
  11. I'm running fine!
  12. appdir$
  13.      
  14. $ sudo npm install -g myapp
  15. └── myapp@0.1.0
  16. $ myapp
  17. /usr/local/lib/node_modules/myapp/src/app.js:1
  18. (function (exports, require, module, __filename, __dirname) { import package from 'package';
  19.                                                               ^^^^^^
  20.  
  21. SyntaxError: Unexpected token import
  22.     at exports.runInThisContext (vm.js:53:16)
  23.     at Module._compile (module.js:404:25)
  24.     at Module._extensions..js (module.js:432:10)
  25.     at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/myapp/node_modules/babel-register/lib/node.js:138:7)
  26.     at Module.load (module.js:356:32)
  27.     at Function.Module._load (module.js:313:12)
  28.     at Module.require (module.js:366:17)
  29.     at require (module.js:385:17)
  30.     at Object.<anonymous> (/usr/local/lib/node_modules/myapp/server.js:9:12)
  31.     at Module._compile (module.js:425:26)
  32.      
  33. ├─┬ babel-register@6.4.3
  34.     │ │ ├─┬ babel-core@6.4.5
  35.     │ │ │ ├─┬ babel-code-frame@6.3.13
  36.     │ │ │ ├─┬ babel-generator@6.4.5
  37.     │ │ │ ├── babel-helpers@6.4.5
  38.     │ │ ├── babel-runtime@5.8.35
  39.      
  40. require('babel-register')({
  41.   ignore: false,
  42.   only: /myapp/src/
  43. });
  44. require('./src/app.js');
  45.      
  46. $ sudo npm install -g node-inspector
  47.      
  48. $ node-debug --debug-brk myapp
  49.      
  50. babel-register/lib/node.js:120:
  51. function shouldIgnore(filename) {
  52.   if (!ignore && !only) {  // here `ignore` and `only` were null, despite .babelrc values
  53.     return getRelativePath(filename).split(_path2["default"].sep).indexOf("node_modules") >= 0;
  54.   } else {
  55.     return _babelCore.util.shouldIgnore(filename, ignore || [], only);
  56.   }
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top