mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-06 02:59:55 +00:00
Refactor build to produce source-map for node debugging
Signed-off-by: 20k-ultra <3946250+20k-ultra@users.noreply.github.com>
This commit is contained in:
parent
5513a9a045
commit
37f23d670d
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"name": "Attach to remote",
|
||||
"address": "127.0.0.1",
|
||||
"port": 9229,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"program": "${workspaceRoot}/src/app.ts",
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/dist/bundle.js"
|
||||
],
|
||||
"sourceMaps": true,
|
||||
"localRoot": "${workspaceFolder}",
|
||||
"remoteRoot": "/usr/src/app"
|
||||
}
|
||||
]
|
||||
}
|
@ -101,6 +101,12 @@ and sync any relevant file changes to the running supervisor
|
||||
container. It will then decide if the container should be
|
||||
restarted, or let nodemon handle the changes.
|
||||
|
||||
### Debugging
|
||||
|
||||
Using live push the supervisor starts with remote debugging enabled via the --inspect flag. Use Chrome dev tools, or your IDE to [start a debugging session](https://nodejs.org/en/docs/guides/debugging-getting-started/#inspector-clients).
|
||||
|
||||
Connect your debugger to `<device-local-ip>:9229`
|
||||
|
||||
### Using balenaOS-in-container
|
||||
|
||||
This process will allow you to run a development instance of the supervisor on your local computer. It is not recommended for production scenarios, but allows someone developing on the supervisor to test changes quickly.
|
||||
|
2
entry.sh
2
entry.sh
@ -58,7 +58,7 @@ modprobe ip6_tables || true
|
||||
|
||||
if [ "${LIVEPUSH}" = "1" ]; then
|
||||
exec npx nodemon --watch src --watch typings --ignore tests -e js,ts,json \
|
||||
--exec node -r ts-node/register/transpile-only src/app.ts
|
||||
--exec node -r ts-node/register/transpile-only --inspect=0.0.0.0 src/app.ts
|
||||
else
|
||||
exec node /usr/src/app/dist/app.js
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@
|
||||
"strictFunctionTypes": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"preserveConstEnums": true,
|
||||
"inlineSourceMap": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "./build/",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2019"],
|
||||
|
@ -70,11 +70,12 @@ console.log('Using the following dependencies as external:', externalModules);
|
||||
module.exports = function (env) {
|
||||
return {
|
||||
mode: env == null || !env.noOptimize ? 'production' : 'development',
|
||||
devtool: 'none',
|
||||
devtool: 'source-map',
|
||||
entry: './src/app.ts',
|
||||
output: {
|
||||
filename: 'app.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts', '.json'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user