Skip to content

Commit

Permalink
fix(webpack): Fixed libraryTarget option not being set for node targe…
Browse files Browse the repository at this point in the history
…ts (nrwl#20505)
  • Loading branch information
TriPSs authored Dec 4, 2023
1 parent 43a4482 commit a08fdf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion e2e/node/src/node-webpack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Node Applications + webpack', () => {

await runCLIAsync(`build ${app} --optimization`);
const optimizedContent = readFile(`dist/apps/${app}/main.js`);
expect(optimizedContent).toContain('console.log("foo bar")');
expect(optimizedContent).toContain('console.log("foo "+"bar")');

// Test that serve can re-run dependency builds.
const lib = uniq('nodelib');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ function applyNxIndependentConfig(

config.output = {
...config.output,
libraryTarget:
(config as Configuration).output?.libraryTarget ??
options.target === 'node'
? 'commonjs'
: undefined,
path:
config.output?.path ??
(options.outputPath
Expand Down

0 comments on commit a08fdf0

Please sign in to comment.