mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-27564] Self-host configuration is not applied with nx build (#17279)
* fix: web not using env variables * fix: apply claude suggestion * fix: remove non-working serve targets
This commit is contained in:
@@ -154,45 +154,15 @@
|
|||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"oss": {
|
"oss": {
|
||||||
"buildTarget": "web:build:oss"
|
|
||||||
},
|
|
||||||
"oss-dev": {
|
|
||||||
"buildTarget": "web:build:oss-dev"
|
"buildTarget": "web:build:oss-dev"
|
||||||
},
|
},
|
||||||
"commercial": {
|
"commercial": {
|
||||||
"buildTarget": "web:build:commercial"
|
|
||||||
},
|
|
||||||
"commercial-dev": {
|
|
||||||
"buildTarget": "web:build:commercial-dev"
|
"buildTarget": "web:build:commercial-dev"
|
||||||
},
|
},
|
||||||
"commercial-qa": {
|
|
||||||
"buildTarget": "web:build:commercial-qa"
|
|
||||||
},
|
|
||||||
"commercial-cloud": {
|
|
||||||
"buildTarget": "web:build:commercial-cloud"
|
|
||||||
},
|
|
||||||
"commercial-euprd": {
|
|
||||||
"buildTarget": "web:build:commercial-euprd"
|
|
||||||
},
|
|
||||||
"commercial-euqa": {
|
|
||||||
"buildTarget": "web:build:commercial-euqa"
|
|
||||||
},
|
|
||||||
"commercial-usdev": {
|
|
||||||
"buildTarget": "web:build:commercial-usdev"
|
|
||||||
},
|
|
||||||
"commercial-ee": {
|
|
||||||
"buildTarget": "web:build:commercial-ee"
|
|
||||||
},
|
|
||||||
"oss-selfhost": {
|
"oss-selfhost": {
|
||||||
"buildTarget": "web:build:oss-selfhost"
|
|
||||||
},
|
|
||||||
"oss-selfhost-dev": {
|
|
||||||
"buildTarget": "web:build:oss-selfhost-dev"
|
"buildTarget": "web:build:oss-selfhost-dev"
|
||||||
},
|
},
|
||||||
"commercial-selfhost": {
|
"commercial-selfhost": {
|
||||||
"buildTarget": "web:build:commercial-selfhost"
|
|
||||||
},
|
|
||||||
"commercial-selfhost-dev": {
|
|
||||||
"buildTarget": "web:build:commercial-selfhost-dev"
|
"buildTarget": "web:build:commercial-selfhost-dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ const config = require(path.resolve(__dirname, "config.js"));
|
|||||||
const pjson = require(path.resolve(__dirname, "package.json"));
|
const pjson = require(path.resolve(__dirname, "package.json"));
|
||||||
|
|
||||||
module.exports.getEnv = function getEnv(params) {
|
module.exports.getEnv = function getEnv(params) {
|
||||||
const ENV = params.env || (process.env.ENV == null ? "development" : process.env.ENV);
|
const ENV = params.env?.ENV ?? process.env?.ENV ?? "development";
|
||||||
const NODE_ENV = process.env.NODE_ENV == null ? "development" : process.env.NODE_ENV;
|
const NODE_ENV = params.env?.NODE_ENV ?? process.env?.NODE_ENV ?? "development";
|
||||||
const LOGGING = process.env.LOGGING != "false";
|
const LOGGING =
|
||||||
|
params.env?.LOGGING ??
|
||||||
|
(process.env?.LOGGING === undefined ? true : process.env.LOGGING !== "false");
|
||||||
|
|
||||||
return { ENV, NODE_ENV, LOGGING };
|
return { ENV, NODE_ENV, LOGGING };
|
||||||
};
|
};
|
||||||
@@ -35,7 +37,11 @@ const DEFAULT_PARAMS = {
|
|||||||
* tsConfig: string;
|
* tsConfig: string;
|
||||||
* outputPath?: string;
|
* outputPath?: string;
|
||||||
* mode?: string;
|
* mode?: string;
|
||||||
* env?: string;
|
* env?: {
|
||||||
|
* ENV?: string;
|
||||||
|
* NODE_ENV?: string;
|
||||||
|
* LOGGING?: boolean;
|
||||||
|
* };
|
||||||
* importAliases?: import("webpack").ResolveOptions["alias"];
|
* importAliases?: import("webpack").ResolveOptions["alias"];
|
||||||
* }} params
|
* }} params
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ module.exports = (webpackConfig, context) => {
|
|||||||
},
|
},
|
||||||
tsConfig: "apps/web/tsconfig.build.json",
|
tsConfig: "apps/web/tsconfig.build.json",
|
||||||
outputPath: path.resolve(context.context.root, context.options.outputPath),
|
outputPath: path.resolve(context.context.root, context.options.outputPath),
|
||||||
|
env: context.options.env,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return buildConfig({
|
return buildConfig({
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const { buildConfig } = require(path.resolve(__dirname, "../../apps/web/webpack.
|
|||||||
|
|
||||||
module.exports = (webpackConfig, context) => {
|
module.exports = (webpackConfig, context) => {
|
||||||
const isNxBuild = context && context.options;
|
const isNxBuild = context && context.options;
|
||||||
|
|
||||||
if (isNxBuild) {
|
if (isNxBuild) {
|
||||||
return buildConfig({
|
return buildConfig({
|
||||||
configName: "Commercial",
|
configName: "Commercial",
|
||||||
@@ -23,6 +24,7 @@ module.exports = (webpackConfig, context) => {
|
|||||||
alias: "@bitwarden/commercial-sdk-internal",
|
alias: "@bitwarden/commercial-sdk-internal",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
env: context.options.env,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return buildConfig({
|
return buildConfig({
|
||||||
|
|||||||
Reference in New Issue
Block a user