pwa-kit icon indicating copy to clipboard operation
pwa-kit copied to clipboard

[FEATURE] Make nodejs inspect configurable

Open nx-renezwinge opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. Currently nodejs inspect can not be configured. It starts default with 127.0.0.1:9229. But if you run the frontend in a docker container, you can not reach it. The IP must be changed into 0.0.0.0 to make it works. This is currently not possible. Or if you have a second app already running which is using 9229, then we have no possibility to change the port for inspect.

Describe the solution you'd like Please add to pwa-kit-dev start command two new parameters like inspectIP and inspectPort

Describe alternatives you've considered Found no alternatives.

Sample

program
        .command('start')
        .description(`develop your app locally`)
        .addOption(
            new program.Option('--inspect', 'enable debugging with --inspect on the node process')
        )
        .addOption(new program.Option('--noHMR', 'disable the client-side hot module replacement'))
        .action(({inspect, noHMR}) => {
            execSync(
                `node${inspect ? ' --inspect=0.0.0.0:9229' : ''} ${p.join(process.cwd(), 'app', 'ssr.js')}`,
                {
                    env: {
                        ...process.env,
                        ...(noHMR ? {HMR: 'false'} : {})
                    }
                }
            )
        })

nx-renezwinge avatar Oct 14 '22 11:10 nx-renezwinge

This issue has been linked to a new work item: W-11911359

git2gus[bot] avatar Oct 14 '22 19:10 git2gus[bot]

Thank you for raising this issue! This is a reasonable ask. We will take this up with the team and add it to our capacity when it is available.

alexvuong avatar Oct 14 '22 19:10 alexvuong

@alexvuong Thx, I'm happy to hear, it will be investigated.

nx-renezwinge avatar Oct 17 '22 10:10 nx-renezwinge

Did you consider to just change the start:inspect script in your local project?

"start:inspect": "NODE_OPTIONS='--inspect=<yourIP>:<yourPort>' npm run start"

muenzpraeger avatar Nov 16 '22 16:11 muenzpraeger

Did you consider to just change the start:inspect script in your local project?

"start:inspect": "NODE_OPTIONS='--inspect=<yourIP>:<yourPort>' npm run start"

Hi @muenzpraeger, i copied the command out of the script

cross-env NODE_ICU_DATA=node_modules/full-icu node --inspect=0.0.0.0:9229 app/ssr.js

But your hint with the node options env var is much cleaner, i will try it out. Thx.

nx-renezwinge avatar Nov 17 '22 06:11 nx-renezwinge