Files
clients/apps/browser/webpack.config.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2025-10-14 06:27:10 -04:00
const path = require("path");
const { buildConfig } = require("./webpack.base");
2018-04-03 22:14:54 -04:00
2025-10-14 06:27:10 -04:00
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: "OSS",
popup: {
entry: path.resolve(__dirname, "src/popup/main.ts"),
entryModule: "src/popup/app.module#AppModule",
},
background: {
entry: path.resolve(__dirname, "src/platform/background.ts"),
},
tsConfig: path.resolve(__dirname, "tsconfig.json"),
2025-10-14 06:27:10 -04:00
outputPath:
context.context && context.context.root
? path.resolve(context.context.root, context.options.outputPath)
: context.options.outputPath,
mode: mode,
env: ENV,
});
} else {
// npm build configuration
return buildConfig({
configName: "OSS",
popup: {
entry: path.resolve(__dirname, "src/popup/main.ts"),
entryModule: "src/popup/app.module#AppModule",
},
background: {
entry: path.resolve(__dirname, "src/platform/background.ts"),
},
tsConfig: "tsconfig.json",
});
}
};