From 6d2899cdca906c8429f089467e5153c5bb678ad9 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 11 Oct 2024 11:05:17 +0200 Subject: [PATCH 1/2] docs/tooling: update backend dev bundling docs Signed-off-by: Patrik Oldsberg --- docs/tooling/cli/02-build-system.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/tooling/cli/02-build-system.md b/docs/tooling/cli/02-build-system.md index dfd95ae6eb..96c46bed6a 100644 --- a/docs/tooling/cli/02-build-system.md +++ b/docs/tooling/cli/02-build-system.md @@ -364,22 +364,19 @@ load performance. ### Backend Development -The backend development bundling is also based on Webpack, but rather than -starting up a web server, the backend is started up using the -[`RunScriptWebpackPlugin`](https://www.npmjs.com/package/run-script-webpack-plugin). -The reason for using Webpack for development of the backend is both that it is a -convenient way to handle transpilation of a large set of packages, as well us -allowing us to use hot module replacement and maintaining state while reloading -individual backend modules. This is particularly useful when running the backend -with in-memory SQLite as the database choice. +The backend development setup does not use any bundling process. It runs a +Node.js process directly, with only-the-fly transpilation from TypeScript to +JavaScript. The transpilation is done with a custom transform based on +[SWC](https://swc.rs/). -Except for executing in Node.js rather than a web server, the backend -development bundling configuration is quite similar to the frontend one. It -shares most of the Webpack configuration, including the transpilation setup. -Some differences are that it does not inject any environment variables or node -module fallbacks, and it uses -[`webpack-node-externals`](https://www.npmjs.com/package/webpack-node-externals) -to avoid bundling in dependency modules. +During development the backend Node.js process will restart whenever there is a +change to the source code. This means that any in-memory data will be lost. In +order to store data between restarts, the backend process has an IPC channel +available to store and restore data from the parent CLI process. The primary +purpose of this, which is already built-in, is to restore the contents of +databases when using SQLite for development. You can also use it for your own +purposes too, with the `DevDataStore` utility exported from the +`@backstage/backend-dev-utils` package. If you want to inspect the running Node.js process, the `--inspect` and `--inspect-brk` flags can be used, as they will be passed through as options to From dea0d6cd11d95ab4f0d747d7513d02115daf8a52 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 11 Oct 2024 12:00:17 +0200 Subject: [PATCH 2/2] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Signed-off-by: Patrik Oldsberg --- docs/tooling/cli/02-build-system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tooling/cli/02-build-system.md b/docs/tooling/cli/02-build-system.md index 96c46bed6a..f1fb5f6c9e 100644 --- a/docs/tooling/cli/02-build-system.md +++ b/docs/tooling/cli/02-build-system.md @@ -365,7 +365,7 @@ load performance. ### Backend Development The backend development setup does not use any bundling process. It runs a -Node.js process directly, with only-the-fly transpilation from TypeScript to +Node.js process directly, with on-the-fly transpilation from TypeScript to JavaScript. The transpilation is done with a custom transform based on [SWC](https://swc.rs/). @@ -375,7 +375,7 @@ order to store data between restarts, the backend process has an IPC channel available to store and restore data from the parent CLI process. The primary purpose of this, which is already built-in, is to restore the contents of databases when using SQLite for development. You can also use it for your own -purposes too, with the `DevDataStore` utility exported from the +purposes, with the `DevDataStore` utility exported from the `@backstage/backend-dev-utils` package. If you want to inspect the running Node.js process, the `--inspect` and