Comments (13)
This should work without problems. Do you get errors?
from iron-node.
This is not that I have errors, but I have just no clue how to do it. I usually run my ES6 code using babel-node directly. If I run iron-node myES6Code.js
it obviously doesn't work because many ES6 features I need aren't supported yet.
I tried babel myES6Code.js --source-maps inline | iron-node
but it doesn't work as iron-node is not POSIX (it does not read input from stdin, but need a file path). Obviously I can build my ES6 file with babel and source-maps into a temporary file and then open iron-node on this file, but that's quite annoying.
It would be nice if iron-node had a way to declare a pre-processor, a little bit like mocha does it :
mocha --compilers js:babel/register myTestFile
.
If there is such a behavior I haven't find it documented. If not it would be a great addition to your already great debugger.
from iron-node.
You can config es 6 features as described at https://github.com/s-a/iron-node/blob/master/docs/CONFIGURATION.md#v8-flags. So babel might not be needed. iron Node supports source maps as described at #52 (comment)
@jonaswindey is using babel. May he can help out because he have more experience about this topic than me. In generell you could write a simple bash precompile your stack and exec ironNode.
from iron-node.
@StyMaar set your sourcemaps to both
instead of inline
. I forget where I found that, but this seems to be the only way to get Babel source maps to work with node-inspector or iron-node.
from iron-node.
Just create an entry point with 2 lines:
require('babel/register')({stage: 0})
from that on, just require your main app entry point
require('./index')
That will give you es6/es7 with debugging functionalities. Don't forget to put your breakpoint in the file:// list of files, not in the local workspace files.
from iron-node.
Thank you @jonaswindey , I can confirm that this worked, I created a new entry point for the app called debug.js
and placed the two lines of code there.
from iron-node.
Using the debug.js
technique which mostly works, but now my app is ignoring the NODE_PATH
setting, so imports are failing.
from iron-node.
If it is possible to set NODE_PATH
programmatically we could add a setup for it to .iron-node.js. @jonaswindey do you have already a solution for this problem? @ericelliott can you provide a simple reproducable example at github?
from iron-node.
@ericelliott can you try to call this module within your code to test if we could solve the issue this way? https://www.npmjs.com/package/enforce-node-path
from iron-node.
The NODE_PATH
environment variable is set correctly. enforce-node-path
seems to do nothing but throw an error if it doesn't match.
What I'm saying is that NODE_PATH
is set as expected, but it seems to be ignored when I do this:
"debug:unit": "NODE_PATH=source iron-node source/test/unit/debug.js",
This works fine:
"test:unit": "NODE_PATH=source babel-node source/test/unit/index.js",
debug.js
looks like this:
require('babel-core/register');
require('./index.js');
As you can see, the test directory containing debug.js
is inside the source
directory.
from iron-node.
OK . Sorry... Seems environment variables are not accessible by spawned electron instance. I think this one should be adressed to a new issue.
from iron-node.
See #98
from iron-node.
This does not work if using imports
from iron-node.
Related Issues (20)
- fails to stop on `debugger;` command HOT 4
- A dynamic link library (DLL) initialization routine failed (bcrypt) HOT 2
- iron-node not working with angular2-seed (typescript, gulp) HOT 1
- iron-node > 2.2.15 makes unicorns cry => doesn't work on OSX HOT 4
- Application takes 100% CPU and is unresponsive HOT 4
- Problem with using node-sass on Ubuntu 16.04 HOT 1
- command + w closes iron-node even when iron-node is behind another window HOT 1
- How to pass command to nodejs? HOT 1
- All good things come to an end.. HOT 4
- Publish a new version HOT 2
- new installation requieres install -g and still can't start HOT 7
- Run this in the web browser HOT 1
- No such module: atom_renderer_v8_util HOT 7
- Electron failed to install correctly, please delete node_modules/electron and try installing again HOT 5
- [feature request] Debugging without writing debugger HOT 4
- Electron Helper crashes when refreshing while devtools is paused HOT 4
- contextify.node was compiled against a different Node.js version using NODE_MODULE_VERSION 48 HOT 1
- Error: Cannot find module, despite NODE_PATH being set
- Usage with babel-node HOT 1
- Child Processes don't show in the logs or in the source
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 iron-node.