docs/tooling: update backend dev bundling docs
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user