Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webpack): fixing null pointer about projectGraph with nx enhance configuration #26430

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f2377a5
fix(webpack): fixing null pointer about projectGraph with nx enhance …
NicolasBelliard Jun 6, 2024
bc020e5
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 6, 2024
489b864
fix(webpack): fixing test for nx enhance webpack config
NicolasBelliard Jun 7, 2024
56c52e1
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 7, 2024
b60f266
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 10, 2024
6233562
fix(webpack): remove comment useless to setup the test
NicolasBelliard Jun 10, 2024
782db0a
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 12, 2024
2305e4b
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 14, 2024
95897fe
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 14, 2024
4c64c1d
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 16, 2024
99d7872
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 17, 2024
5a5f110
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 18, 2024
dd7e020
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 19, 2024
2be58d4
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 20, 2024
1639a09
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 20, 2024
acdd739
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 24, 2024
fd2e9c0
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 25, 2024
339e69f
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jun 26, 2024
ab45e72
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jul 2, 2024
c3300e2
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jul 3, 2024
3469b9a
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jul 5, 2024
e998a01
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jul 8, 2024
6e9abe9
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jul 8, 2024
33e3e91
Merge branch 'master' into fixing-project-graph-null
NicolasBelliard Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions e2e/webpack/src/webpack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,42 @@ describe('Webpack Plugin', () => {
`Successfully ran target build for project ${appName} and 1 task it depends on`
);
});

it('should be able to support webpack config with nx enhanced and babel', () => {
const appName = uniq('app');

runCLI(
`generate @nx/web:app ${appName} --bundler=webpack --compiler=babel`
);

updateFile(
`apps/${appName}/webpack.config.js`,
`
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const { join } = require('path');

const pluginOption = {
index: 'apps/${appName}/src/index.html',
main: 'apps/${appName}/src/main.ts',
tsConfig: 'apps/${appName}/tsconfig.app.json',
outputPath: 'dist/apps/${appName}',
}

// Nx composable plugins for webpack.
module.exports = composePlugins(
withNx(pluginOption),
withReact(pluginOption),
);`
);

const result = runCLI(`build ${appName}`);

expect(result).toContain(`nx run ${appName}:build`);
expect(result).toContain(
`Successfully ran target build for project ${appName}`
);
});
});

function readMainFile(dir: string): string {
Expand Down
1 change: 1 addition & 0 deletions packages/webpack/src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ function ensureNxWebpackExecutionContext(ctx: NxWebpackExecutionContext): void {
cwd: process.cwd(),
root: workspaceRoot,
isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
projectGraph,
};
}