Using Babel in my NodeJSv4.1.1 code.
Got the require hook in:
require("babel-core/register");
$appRoot = __dirname;
module.exports = require("./lib/controllers/app");
In a subsequently lodaded .js file I am doing:
import { Strategy as LocalStrategy } from "passport-local";
However this is generating the following error in the CLI:
import { Strategy as LocalStrategy } from "passport-local";
^^^^^^
SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at loader (/Users/*/Documents/Web/*/node_modules/babel-core/node_modules/babel-register/lib/node.js:128:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/*/Documents/Web/*/node_modules/babel-core/node_modules/babel-register/lib/node.js:138:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at module.exports (index.js:9:5)
at Object.<anonymous> (app.js:102:39)
"babel-core": "^6.1.21"$passport = require('passport');tovar $passport = require('passport');, do you still see that error?babel-registermodule as suggested by the docs since you're using Babel 6. Then make sure the file in question isn't getting ignored. See @pherris' comment below