Open
Description
I'm not sure if this is a Babel or a node-postgres bug, steps to reproduce:
export PATH=$PATH:/tmp/iojs-v3.0.0-linux-x64/bin/:./node_modules/.bin
mkdir t
cd t
npm install babel pg
# create a t.js file with this ES6 content:
import * as pg from "pg";
console.log(pg);
# now execute:
babel t.js > t-es5.js
node t-es5.js
Error: Cannot find module 'pg-native'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/tmp/o/node_modules/pg/lib/native/index.js:1:76)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Babel generates the following code in t-es5.js
:
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
var _pg = require("pg");
var pg = _interopRequireWildcard(_pg);
console.log(pg);
The exception is happening in the _interopRequireWildcard(_pg)
call. This doesn't happens with other libraries, so I'm not sure if a Babel or a node-postgres bug.
Metadata
Metadata
Assignees
Labels
No labels