Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with --enable-source-maps #173

Closed
skrylnikov opened this issue Oct 28, 2019 · 5 comments
Closed

Not working with --enable-source-maps #173

skrylnikov opened this issue Oct 28, 2019 · 5 comments
Labels

Comments

@skrylnikov
Copy link

skrylnikov commented Oct 28, 2019

run script:
node -r ts-node/register --enable-source-maps index.ts

exception:

path/node_modules/threads/dist/master/implementation.node.js:51
    const parentCallSite = callsites_1.default().find((callsite) => {
                                                 ^
TypeError: callsites_1.default(...).find is not a function
    at rebaseScriptPath (path/node_modules/threads/dist/master/implementation.node.js:51:50)
    at resolveScriptPath (path/node_modules/threads/dist/master/implementation.node.js:63:27)
    at new Worker (path/node_modules/threads/dist/master/implementation.node.js:74:40)
    at path/src/csv/index.ts:4:51
        -> path/src/csv/index.ts:3:31
    at path/node_modules/threads/dist/master/pool.js:85:15
    at Array.map (<anonymous>)
    at spawnWorkers (path/node_modules/threads/dist/master/pool.js:84:31)
    at Object.PoolConstructor [as Pool] (path/node_modules/threads/dist/master/pool.js:99:21)
    at Object.<anonymous> (path/src/csv/index.ts:4:24)
        -> path/src/csv/index.ts:3:14
    at Module._compile (internal/modules/cjs/loader.js:956:30)

main.ts:

import { spawn, Worker, Pool } from 'threads';

const pool = Pool(() => spawn(new Worker('./worker.ts')), 4);

worker.ts:

import { expose } from 'threads/worker';

const start = ()=>{
  console.log('start worker');
  
};

export type Start = typeof start;

expose(start);
 
@skrylnikov skrylnikov changed the title Not working witch --enable-source-maps Not working with --enable-source-maps Oct 28, 2019
@andywer andywer added the bug label Oct 28, 2019
@andywer
Copy link
Owner

andywer commented Oct 28, 2019

Hey @skrylnikov! Thanks for reporting, that really does look weird.

Can you confirm that it works without --enable-source-maps and can you console.log(callsites_1) right before the error is thrown, please?

@skrylnikov
Copy link
Author

Yes, it works without --enable-source-maps.
I think I find problem. It occurs in callsites. Callsites use Error.prepareStackTrace, But Error.prepareStackTrace not work with --enable-source-maps.
nodejs/node#29994

@andywer
Copy link
Owner

andywer commented Oct 29, 2019

Good catch. Let's open an issue at the callsites repo then. Can you tell me what the callsites call returns when the source maps are on? Would be an important detail when we open the issue at their repo.

@andywer
Copy link
Owner

andywer commented Nov 29, 2019

Ping. Please see above 👆😉

@andywer
Copy link
Owner

andywer commented Dec 23, 2019

Closing, due to inactivity.

@andywer andywer closed this as completed Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants