Giter Site home page Giter Site logo

Comments (13)

s-a avatar s-a commented on July 18, 2024

This should work without problems. Do you get errors?

from iron-node.

StyMaar avatar StyMaar commented on July 18, 2024

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.

s-a avatar s-a commented on July 18, 2024

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.

nickytonline avatar nickytonline commented on July 18, 2024

@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.

jonaswindey avatar jonaswindey commented on July 18, 2024

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.

vamsiampolu avatar vamsiampolu commented on July 18, 2024

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.

ericelliott avatar ericelliott commented on July 18, 2024

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.

s-a avatar s-a commented on July 18, 2024

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.

s-a avatar s-a commented on July 18, 2024

@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.

ericelliott avatar ericelliott commented on July 18, 2024

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.

s-a avatar s-a commented on July 18, 2024

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.

ericelliott avatar ericelliott commented on July 18, 2024

See #98

from iron-node.

stoplion avatar stoplion commented on July 18, 2024

This does not work if using imports

from iron-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.