Comments (6)
Ok if the example is wrong I have created a new example that does work:
original.js:
require('source-map-support').install();
throw new Error('test'); // This is the original code
compiled.js:
throw require("source-map-support").install(),new Error("test");
//# sourceMappingURL=compiles.js.map
compiled.js.map:
{"version":3,"sources":["original.js"],"names":["require","install","Error"],"mappings":"AAEA,KAFAA,SAAQ,sBAAsBC,UAExB,GAAIC,OAAM"}
from node-source-map-support.
This project is not broken, I use it regularly!
But indeed, the demo is not working as it should…
from node-source-map-support.
Maybe put this in a example dir in the repo? to make it easier for people?
from node-source-map-support.
Ditto. It looks like the culprit for me is the "transform-strict-mode" plugin:
$ cat foo.js
require('source-map-support').install();
throw new Error('test'); // This is the original code
$ babel-node foo.js
Error: test
at Object.<anonymous> (/private/tmp/foo/foo.js:5:7)
at Module._compile (module.js:399:26)
at loader (/Users/crabdude/.npmprefix/lib/node_modules/babel-cli/node_modules/babel-register/lib/node.js:130:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/crabdude/.npmprefix/lib/node_modules/babel-cli/node_modules/babel-register/lib/node.js:140:7)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Function.Module.runMain (module.js:431:10)
at /Users/crabdude/.npmprefix/lib/node_modules/babel-cli/lib/_babel-node.js:161:27
at Object.<anonymous> (/Users/crabdude/.npmprefix/lib/node_modules/babel-cli/lib/_babel-node.js:162:7)
at Module._compile (module.js:399:26)
$ babel-node -V
6.3.17
$ npm ls source-map-support
[email protected] /private/tmp/foo
└── [email protected] extraneous
$ node -v
v5.2.0
$ cat .babelrc
{
"plugins": ["transform-strict-mode"]
}
It would be nice to know if this is a bug with babel-plugin-transform-strict-mode
or node-source-map-support
.
from node-source-map-support.
Re: @CrabDude's "transform-strict-mode" plugin issue:
This isn't a problem for me from babel-node 6.24.0 and node 6.10.
$ npm i babel-cli babel-plugin-transform-strict-mode source-map-support
$ cat foo.js
require('source-map-support').install();
throw new Error('test'); // This is the original code
$ cat .babelrc
{
"plugins": ["transform-strict-mode"]
}
$ babel-node foo.js
throw new Error('test'); // This is the original code
^
Error: test
at Object.<anonymous> (F:/tmp/@CrabDude/foo.js:2:7)
at Module._compile (module.js:570:32)
at loader (F:\tmp\@CrabDude\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (F:\tmp\@CrabDude\node_modules\babel-register\lib\node.js:154:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Function.Module.runMain (module.js:604:10)
at Object.<anonymous> (F:\tmp\@CrabDude\node_modules\babel-cli\lib\_babel-node.js:154:22)
at Module._compile (module.js:570:32)
$ babel foo.js --out-file compiled-foo.js --source-maps
$ node compiled-foo.js
throw new Error('test'); // This is the original code
^
Error: test
at Object.<anonymous> (F:\tmp\@CrabDude\foo.js:2:7)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
from node-source-map-support.
This is fixed now 👏
from node-source-map-support.
Related Issues (20)
- Module not found: Error: Can't resolve 'crypto' in '\ClientApp\node_modules\typescript\lib'
- lib throws error with "Cannot read property 'isNative' of undefined" HOT 2
- Problems with Node 12 on Windows
- Removes error code from node errors HOT 2
- [meta] are tests running on CI? HOT 1
- Format the output so it can be clicked HOT 1
- decodeURI for chinese filename
- Using source map support removes details from some errors HOT 1
- TypeError: Cannot read property 'String' of undefined HOT 1
- Cannot find module when `import "source-map-support/register"` HOT 2
- Leaking event hooks which prevents process from exiting
- Error still show compiled code
- Error still show compiled code
- Source-map needs to be updated to 0.8.0-beta.0 HOT 1
- RangeError Maximum call stack size exceeded when testing Vue project HOT 1
- `lastIndexOf` in `sourcemap-register.js` causes Github to flag `Incorrect suffix check` HOT 4
- document that this package is no longer needed as of node 12.12.0
- WASM traces do not correspond to expected offsets HOT 2
- Provide esm version HOT 2
- Dependency of some other major open source projects
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-source-map-support.