Skip to content

Commit

Permalink
fix(node): build-esbuild-options.ts browser user define envs by config (
Browse files Browse the repository at this point in the history
nrwl#27480)

## Current Behavior
When you use esbuild in 'browser' mode you have to provide all 'define'
attributes as environment variables and only with "NX_PUBLIC_" prefix

## Expected Behavior
Esbuild configuration has to work as it is described in docs. And prefix
feature has to work as an additional functionality

## Related Issue(s)
This issue will be fixed: nrwl#19106

Co-authored-by: Dmitrii Kamenskikh <[email protected]>
  • Loading branch information
coolassassin and Dmitrii Kamenskikh authored Aug 16, 2024
1 parent b5a9336 commit 4941be6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ export function buildEsbuildOptions(
};

if (options.platform === 'browser') {
esbuildOptions.define = getClientEnvironment();
esbuildOptions.define = {
...getClientEnvironment(),
...options.userDefinedBuildOptions?.define,
};
}

if (!esbuildOptions.outfile && !esbuildOptions.outdir) {
Expand Down

0 comments on commit 4941be6

Please sign in to comment.