1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00
Files
browser/bitwarden_license/bit-browser/webpack.config.js
Andreas Coroiu 64590cb3c8 [PM-25911] Add commercial sdk internal as dependency (#16883)
* feat: add commercial sdk as optional dependency

* feat: add alias to CLI

* feat: add alias to browser

* feat: add alias to web

* fix: revert optional - we cant omit optional dependencies or the builds break

* feat: remove commercial package from browser build

* feat: remove commercial package from cli build

* feat: remove commercial package from web build

* chore: add commercial sdk to renovate

* fix: windows cli workflow

* fix: accidental change

* feat: add lint for version string

* undo weird merge changes
2025-10-27 15:17:20 +01:00

67 lines
2.0 KiB
JavaScript

const path = require("path");
const { buildConfig } = require("../../apps/browser/webpack.base");
module.exports = (webpackConfig, context) => {
// Detect if called by Nx (context parameter exists)
const isNxBuild = context && context.options;
if (isNxBuild) {
// Nx build configuration
const mode = context.options.mode || "development";
if (process.env.NODE_ENV == null) {
process.env.NODE_ENV = mode;
}
const ENV = (process.env.ENV = process.env.NODE_ENV);
// Set environment variables from Nx context
if (context.options.env) {
Object.keys(context.options.env).forEach((key) => {
process.env[key] = context.options.env[key];
});
}
return buildConfig({
configName: "Commercial",
popup: {
entry: path.resolve(__dirname, "src/popup/main.ts"),
entryModule: "bitwarden_license/bit-browser/src/popup/app.module#AppModule",
},
background: {
entry: path.resolve(__dirname, "src/platform/background.ts"),
},
tsConfig: path.resolve(__dirname, "tsconfig.build.json"),
outputPath:
context.context && context.context.root
? path.resolve(context.context.root, context.options.outputPath)
: context.options.outputPath,
mode: mode,
env: ENV,
importAliases: [
{
name: "@bitwarden/sdk-internal",
alias: "@bitwarden/commercial-sdk-internal",
},
],
});
} else {
// npm build configuration
return buildConfig({
configName: "Commercial",
popup: {
entry: path.resolve(__dirname, "src/popup/main.ts"),
entryModule: "bitwarden_license/bit-browser/src/popup/app.module#AppModule",
},
background: {
entry: path.resolve(__dirname, "src/platform/background.ts"),
},
tsConfig: path.resolve(__dirname, "tsconfig.json"),
importAliases: [
{
name: "@bitwarden/sdk-internal",
alias: "@bitwarden/commercial-sdk-internal",
},
],
});
}
};