nx: 17.2.0 @nx/webpack:webpack executor throws isolatedConfig on simple build with node target
Current Behavior
Given the following simple build target:
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/backend",
"main": "apps/backend/src/main.ts",
"tsConfig": "apps/backend/tsconfig.app.json",
"target": "node",
"compiler": "tsc"
}
},
I encountered the following error:
> nx run backend:build
{
outputPath: 'dist/apps/backend',
main: 'apps/backend/src/main.ts',
tsConfig: 'apps/backend/tsconfig.app.json',
target: 'node',
compiler: 'tsc',
deleteOutputPath: true,
outputFileName: 'main.js',
isolatedConfig: true,
buildLibsFromSource: true,
root: '/Users/bjorn/Development/lab-box/mobvious-platform',
projectRoot: 'apps/backend',
sourceRoot: 'apps/backend/src',
webpackConfig: '',
fileReplacements: [],
optimization: { scripts: undefined, styles: undefined }
}
> NX Using "isolatedConfig" without a "webpackConfig" is not supported.
Pass --verbose to see the stacktrace.
—————————————————————————————————————————————————————————————————————————————————————
> NX Ran target build for project backend (328ms)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
Expected Behavior
It should not throw.
GitHub Repo
No response
Steps to Reproduce
Create simple target using webpack, targetting node.
Run the target.
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/backend",
"main": "apps/backend/src/main.ts",
"tsConfig": "apps/backend/tsconfig.app.json",
"target": "node",
"compiler": "tsc"
}
},
Nx Report
Node : 18.18.0
OS : darwin-arm64
yarn : 1.22.19
nx : 17.2.0
@nx/js : 17.2.0
@nx/jest : 17.2.0
@nx/linter : 17.2.0
@nx/eslint : 17.2.0
@nx/workspace : 17.2.0
@nx/cypress : 17.2.0
@nx/detox : 17.2.0
@nx/devkit : 17.2.0
@nx/eslint-plugin : 17.2.0
@nx/expo : 17.2.0
@nx/nest : 17.2.0
@nx/node : 17.2.0
@nx/react : 17.2.0
@nrwl/tao : 17.2.0
@nx/web : 17.2.0
@nx/webpack : 17.2.0
typescript : 5.2.2
Failure Logs
See above.
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 3
- Comments: 18 (9 by maintainers)
I think they forgot to add a migration somewhere, adding
"webpackConfig": "<directory of your project>/webpack.config.js"with the following config fixes this:Neither
17.2.3nor17.2.4picked up the migration, with or without--from=nx@15.6(which caused other problems), perhaps because ourproject.jsonhad notargets.build.isolatedConfigproperty at all. Adding it and setting it tofalseper @TriPSs removed theUsing "isolatedConfig" without a "webpackConfig" is not supported.error on serve but showed the deprecation warning, so I decided to move on and just manually added in the basewebpack.config.jsand pointedtargets.build.options.webpackConfigto it, per Configure webpack on your Nx workspace, as suggested by @TriPSs and @redplane, which prevented the error and deprecation warning (but the latter only if theisolatedConfigproperty did not exist at all—the warning persists ifisolatedConfig: true, even though the current documentation shows that property inproject.json).Upgraded to nx@17.2.1 from nx@17.2.0 and no migration detected.
I tried with
--from=nx@<ver>but it doesn’t work, keeps throwing the error:Using "isolatedConfig" without a "webpackConfig" is not supported.@KeithGillette with the latest version you can also just put
isolatedConfigtofalse.