18 Commits

Author SHA1 Message Date
Nicholas Cunningham
726c07d324
fix(webpack): Add useTsconfigPaths to app-webpack-plugin (#29291)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-12-11 09:20:57 -07:00
Jason Jean
23bebd91e7
feat(devkit): bump compatibility to Nx 19 - 21.x (#28243)
BREAKING CHANGE

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

* `@nx/devkit` supports Nx 17 - 20.
* Node 18 - 22 is supported 
* `ExecutorContext.projectGraph`, `ExecutorContext.nxJsonConfiguration`,
and `ExecutorContext.projectsConfigurations` is marked as optional
because `ExecutorContext` in some versions of Nx did not have them.
* `ExecutorContext.workspace` is marked as optional because
`ExecutorContext` in some versions of Nx did not have the above
properties which contain the same information.
* `ProjectGraphNode` is deprecated.
* `NxPluginV1.processProjectGraph` was deprecated long ago and there has
been a warning since.
* `appRootPath` has been deprecated for a long time.
* `parseTargetString` had a variant that did not take either the project
graph or the executor context.
* `readNxJson` has a variant which does not take a tree. This was not
clearly deprecated.
* There are handlers to require from `@nx/` instead of `@nrwl`
* Nx tries to get a root install from `@nrwl/cli`


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

* `@nx/devkit` supports Nx 19 - 21.
* Node 20 - 22 is supported 
* `ExecutorContext.projectGraph`, `ExecutorContext.nxJsonConfiguration`,
and `ExecutorContext.projectsConfigurations` is marked as required
because `ExecutorContext` in Nx 19+ is guaranteed to have them.
* `ExecutorContext.workspace` is removed because the same information is
available in the above properties
* `ProjectGraphNode` is removed.
* `NxPluginV1` is no more. All plugins should be `NxPluginV2`.
* `workspaceRoot` is the replacement for `appRootPath`. `appRootPath` is
removed.
* `parseTargetString` no longer has a variant that did not take either
the project graph or the executor context.
* `readNxJson` still has a variant which does not take a tree but it's
clearly deprecated to be removed in Nx 21.
* `@nrwl` packages are no more so we don't have to redirect requires
anymore.
* `@nrwl/cli` is no more so Nx shouldn't try to get a root install there
* 

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-10-03 17:35:47 -04:00
Nicolas Belliard
0e083faff8
fix(webpack): fixing null pointer about projectGraph with nx enhance configuration (#26430)
Hello!

I fixing issue related to nx project with enhanced webpack config.

I created this repository to reproduce the bug:
https://github.com/NicolasBelliard/nx-enhance-example

## Current Behavior
When created an Nx repository with nx enhanced config, we faced the
current issue when we try to build the application.

```
> nx run nx-enhance:build

> webpack-cli build --node-env=production

[webpack-cli] TypeError: Cannot read properties of undefined (reading 'nodes')
    at calculateProjectDependencies (/home/test/dev/nx-enhance/node_modules/@nx/js/src/utils/buildable-libs-utils.js:24:30)
    at calculateProjectBuildableDependencies (/home/test/dev/nx-enhance/node_modules/@nx/js/src/utils/buildable-libs-utils.js:20:12)
    at NxTsconfigPathsWebpackPlugin.handleBuildLibsFromSource (/home/test/dev/nx-enhance/node_modules/@nx/webpack/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js:37:111)
    at NxTsconfigPathsWebpackPlugin.apply (/home/test/dev/nx-enhance/node_modules/@nx/webpack/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js:17:14)
    at createCompiler (/home/test/dev/nx-enhance/node_modules/webpack/lib/webpack.js:78:12)
    at create (/home/test/dev/nx-enhance/node_modules/webpack/lib/webpack.js:145:16)
    at webpack (/home/test/dev/nx-enhance/node_modules/webpack/lib/webpack.js:153:47)
    at WebpackCLI.f [as webpack] (/home/test/dev/nx-enhance/node_modules/webpack/lib/index.js:73:16)
    at WebpackCLI.createCompiler (/home/test/dev/nx-enhance/node_modules/webpack-cli/lib/webpack-cli.js:1785:29)
    at async WebpackCLI.runWebpack (/home/test/dev/nx-enhance/node_modules/webpack-cli/lib/webpack-cli.js:1877:20)
Warning: command "webpack-cli build --node-env=production" exited with non-zero status code


Process finished with exit code 1
```

## Expected Behavior
No error and the build is working.

## Related Issue(s)
https://github.com/nrwl/nx/issues/26303
2024-07-26 11:09:33 -06:00
Jack Hsu
507fe42e4f
feat(webpack): add plugin to automatically configure build and serve targets (#20243) 2023-11-28 13:01:03 -05:00
Jason Jean
2d195007b0
feat(core): switch packages to use the @nx scope (#16069) 2023-04-14 19:56:37 -04:00
Jack Hsu
795e4d6985
fix(webpack): fix support for module federation plugin (#14653) 2023-01-27 14:14:31 +02:00
Dan Roujinsky
a7485d3ecd
chore(webpack): export a type for execution context (#14619) 2023-01-25 12:28:11 -05:00
Kenneth Toxcon
d8bd8ab3f4
fix(react): adding support for async plugins in compose-plugins utility (#14447) 2023-01-21 02:25:35 +00:00
Jack Hsu
454fba49b2
feat(webpack): generate React and Web apps with webpack.config.js file (#14285) 2023-01-12 10:06:25 -05:00
Jack Hsu
6feb56e014
feat(webpack): remove support for legacy browsers (#14190) (#14257) 2023-01-11 10:13:35 +02:00
Jack Hsu
fcc02d1932
feat(webpack): remove support for legacy browsers (#14190) 2023-01-09 12:15:37 +02:00
Jack Hsu
b76871d501
fix(bundling): detect esm vs cjs type for .js files (#14060) 2022-12-29 13:41:56 -05:00
George Karagkiaouris
60a7345580
fix(bundling): fix webpack publicPath: 'auto' behavior for esm builds (#13186)
Fixes https://github.com/nrwl/nx/issues/13185
2022-11-16 13:57:50 -05:00
Tycho Bokdam
a690dbd7e9
fix(webpack): Fixed script optimization not working for node target (#12221) 2022-11-07 11:04:52 -05:00
Jack Hsu
5ae5f8858d
fix(nextjs): return correct webpack config for next.js storybook app (#12371) 2022-10-04 02:36:55 +00:00
Jack Hsu
c3e060247c
fix(bundling): set NODE_ENV correctly to avoid warnings (#12331) 2022-09-30 02:56:14 +00:00
Jack Hsu
84a21e904e
fix(bundling): skip web-specific configuration when bundling for node (#12130) 2022-09-20 20:04:35 +00:00
Jack Hsu
f49769a34a
feat(webpack): add webpack plugin (#11966) 2022-09-12 21:19:50 +01:00