cli: fix node env not being set for backend dev
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Fixed a bug where `NODE_ENV` was not set in the environment when starting the backend in development mode. It has always been the case that Webpack transformed `NODE_ENV` when running in development mode, but this did not affect dependencies in `node_modules` as they are treated as external.
|
||||
@@ -26,6 +26,10 @@ export async function serveBackend(options: BackendServeOptions) {
|
||||
isDev: true,
|
||||
});
|
||||
|
||||
// Webpack only replaces occurrences of this in code it touches, which does
|
||||
// not include dependencies in node_modules. So we set it here at runtime as well.
|
||||
(process.env as { NODE_ENV: string }).NODE_ENV = 'development';
|
||||
|
||||
const compiler = webpack(config, (err: Error | undefined) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
|
||||
Reference in New Issue
Block a user