node-clinic icon indicating copy to clipboard operation
node-clinic copied to clipboard

Does it possible to run it with the babel-node?

Open maslowivan opened this issue 6 years ago • 7 comments

I use babel-node for react jsx and some other stuff. Does it possible to run the clinic flame with the babel-node?

Using command: BROWSERSLIST="> 0.8%, not IE 11" BABEL_DISABLE_CACHE=1 NODE_ENV=production BABEL_ENV=server clinic flame -- babel-node server/server.js

Receiving error:

project/web/clinic.js:13
  if (err) throw err;
           ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at join (path.js:1152:7)
    at v8.catch (project/web/node_modules/0x/index.js:83:27)
    at process._tickCallback (internal/process/next_tick.js:68:7)

maslowivan avatar Apr 29 '19 17:04 maslowivan

Any luck?

ThomasGHenry avatar Jan 30 '20 16:01 ThomasGHenry

@ThomasGHenry no I have created the webpack configuration to build it. And then I run simple node

maslowivan avatar Jan 31 '20 09:01 maslowivan

Thanks

ThomasGHenry avatar Jan 31 '20 18:01 ThomasGHenry

@studentIvan - You need to provide JS to Clinic Flame.

DylanC avatar Feb 07 '20 12:02 DylanC

Clinic.js currently does not work with apps or scripts that wrap node.js. That is, clinic has to be able to launch the node.js process directly because there are command-line flags and bits of code that need to be injected in order to enable the data collection instrumentation that is used. Coming up with a better strategy for this would be good tho, so we can add this to our roadmap to look into.

jasnell avatar Feb 07 '20 15:02 jasnell

Clinic.js currently does not work with apps or scripts that wrap node.js. That is, clinic has to be able to launch the node.js process directly because there are command-line flags and bits of code that need to be injected in order to enable the data collection instrumentation that is used.

I guess clinicjs/node-clinic#441 is pretty much the same as this, and I see @DylanC also replied here: Instead of using babel-node one could just as easily consider using node --require @babel/register, which would still not work nicely (and likely misclassify the files, depending on how babel is configured then).

With more and more babel/typescript/something-to-js usage on the server side (at least from what I can see) it would be great to have a somewhat workable solution here, although documentation for "this is how you should do it" might be enough. After all one would typically want to verify the "production code" anyways for performance issues, so running through an on-the-fly transpiler isn't the best idea anyways. :)

I'm somewhat assuming (can't remember) that clinic does support source-maps though?

ankon avatar Feb 17 '20 13:02 ankon

@ankon - Clinic does not support source maps currently. We are looking into supporting them in the future. First on the agenda will be to detect transpiled code/babel usage and provide a warning to the user.

DylanC avatar Feb 24 '20 11:02 DylanC