Very strange problem I run into, may be someone know what problem is: This problem observed during test in Node v.8.12.0 In Node v>14 everything is OK. (Don't ask me why v.8 is still important.. Yes, we are still there in some apps :-(( )
Super simple app, just import, nothing else (this enough to show the problem):
--index.js--
import express from 'express';
Latest available packages for a simple app:
--package.json--
"dependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.8",
"@babel/node": "^7.16.8",
"@babel/preset-env": "^7.16.11",
"express": "^4.17.3"
}
Babel config:
--.babelrc--
{
"presets": [
[
"@babel/preset-env"
]
],
}
Now complication:
npx babel .\index.js -d dist\
- all good, file dist\index.js
created and node dist\index.js
working fine.
Problem with babel-node
:
> npx babel-node .\index.js
C:\xx\babelssue\node_modules\depd\index.js:252
var file = callSite.getFileName() || '<anonymous>'
^
TypeError: callSite.getFileName is not a function
at callSiteLocation (C:\xx\babelssue\node_modules\depd\index.js:252:23)
at depd (C:\xx\babelssue\node_modules\depd\index.js:111:14)
at Object.<anonymous> (C:\xx\babelssue\node_modules\body-parser\index.js:14:32)
at Module._compile (module.js:653:30)
at Module._compile (C:\xx\babelssue\node_modules\pirates\lib\index.js:136:24)
at Module._extensions..js (module.js:664:10)
at Object.newLoader [as .js] (C:\xx\babelssue\node_modules\pirates\lib\index.js:141:7) at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
PS C:\xx\babelssue>