Browse Source

Task/migrate deprecated @nx/webpack:webpack executor (#7198)

* Migrate deprecated @nx/webpack:webpack executor

* Update changelog
pull/7277/head
Kenrick Tandrian 6 days ago
committed by GitHub
parent
commit
7229d47597
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 26
      apps/api/project.json
  3. 51
      apps/api/webpack.config.js
  4. 10
      nx.json
  5. 111
      package-lock.json
  6. 3
      package.json

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Migrated the deprecated `@nx/webpack:webpack` executor to `@nx/webpack/plugin`
## 3.22.0 - 2026-07-08 ## 3.22.0 - 2026-07-08
### Added ### Added

26
apps/api/project.json

@ -7,32 +7,10 @@
"generators": {}, "generators": {},
"targets": { "targets": {
"build": { "build": {
"executor": "@nx/webpack:webpack",
"options": {
"compiler": "tsc",
"deleteOutputPath": false,
"main": "apps/api/src/main.ts",
"outputPath": "dist/apps/api",
"sourceMap": true,
"target": "node",
"tsConfig": "apps/api/tsconfig.app.json",
"webpackConfig": "apps/api/webpack.config.js"
},
"configurations": { "configurations": {
"production": { "production": {}
"generatePackageJson": true,
"optimization": true,
"extractLicenses": true,
"inspect": false,
"fileReplacements": [
{
"replace": "apps/api/src/environments/environment.ts",
"with": "apps/api/src/environments/environment.prod.ts"
}
]
}
}, },
"outputs": ["{options.outputPath}"] "outputs": ["{workspaceRoot}/dist/apps/api"]
}, },
"copy-assets": { "copy-assets": {
"executor": "nx:run-commands", "executor": "nx:run-commands",

51
apps/api/webpack.config.js

@ -1,6 +1,49 @@
const { composePlugins, withNx } = require('@nx/webpack'); const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
const path = require('path');
module.exports = composePlugins(withNx(), (config, { options, context }) => { // These options were migrated by @nx/webpack:convert-to-inferred from
// Customize webpack config here // the project.json file and merged with the options in this file
return config; const configValues = {
build: {
default: {
compiler: 'tsc',
deleteOutputPath: false,
main: './src/main.ts',
outputPath: 'dist/apps/api',
outputHashing: 'none',
sourceMap: true,
target: 'node',
tsConfig: './tsconfig.app.json'
},
production: {
extractLicenses: true,
fileReplacements: [
{
replace: path.resolve(__dirname, './src/environments/environment.ts'),
with: path.resolve(
__dirname,
'./src/environments/environment.prod.ts'
)
}
],
generatePackageJson: true,
inspect: false,
optimization: true
}
}
};
// Determine the correct configValue to use based on the configuration
const configuration = process.env.NX_TASK_TARGET_CONFIGURATION || 'default';
const buildOptions = {
...configValues.build.default,
...configValues.build[configuration]
};
/**
* @type {import('webpack').WebpackOptionsNormalized}
*/
module.exports = async () => ({
plugins: [new NxAppWebpackPlugin(buildOptions)]
}); });

10
nx.json

@ -67,6 +67,16 @@
} }
}, },
"$schema": "./node_modules/nx/schemas/nx-schema.json", "$schema": "./node_modules/nx/schemas/nx-schema.json",
"plugins": [
{
"plugin": "@nx/webpack/plugin",
"options": {
"buildTargetName": "build",
"serveTargetName": "serve",
"previewTargetName": "preview"
}
}
],
"targetDefaults": { "targetDefaults": {
"build": { "build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],

111
package-lock.json

@ -164,7 +164,8 @@
"ts-jest": "29.4.0", "ts-jest": "29.4.0",
"ts-node": "10.9.2", "ts-node": "10.9.2",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "5.9.2" "typescript": "5.9.2",
"webpack-cli": "7.1.0"
}, },
"engines": { "engines": {
"node": ">=22.18.0" "node": ">=22.18.0"
@ -19378,6 +19379,19 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/envinfo": {
"version": "7.21.0",
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.21.0.tgz",
"integrity": "sha512-Lw7I8Zp5YKHFCXL7+Dz95g4CcbMEpgvqZNNq3AmlT5XAV6CgAAk6gyAMqn2zjw08K9BHfcNuKrMiCPLByGafow==",
"dev": true,
"license": "MIT",
"bin": {
"envinfo": "dist/cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/environment": { "node_modules/environment": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
@ -34613,6 +34627,101 @@
} }
} }
}, },
"node_modules/webpack-cli": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-7.1.0.tgz",
"integrity": "sha512-pSJ5p5PkXRD88sfCq5Wo+coc42QykwRu5Md0DyESj0rT6PPPA2wTNabpHPKgqH8EMkfTDo3IWx3iiNXMu8XDBQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@discoveryjs/json-ext": "^1.1.0",
"commander": "^14.0.3",
"cross-spawn": "^7.0.6",
"envinfo": "^7.21.0",
"import-local": "^3.2.0",
"interpret": "^3.1.1",
"rechoir": "^0.8.0",
"webpack-merge": "^6.0.1"
},
"bin": {
"webpack-cli": "bin/cli.js"
},
"engines": {
"node": ">=20.9.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"peerDependencies": {
"js-yaml": "^4.0.0 || ^5.0.0",
"json5": "^2.2.3",
"toml": "^3.0.0 || ^4.0.0",
"webpack": "^5.101.0",
"webpack-bundle-analyzer": "^4.0.0 || ^5.0.0",
"webpack-dev-server": "^5.0.0"
},
"peerDependenciesMeta": {
"js-yaml": {
"optional": true
},
"json5": {
"optional": true
},
"toml": {
"optional": true
},
"webpack-bundle-analyzer": {
"optional": true
},
"webpack-dev-server": {
"optional": true
}
}
},
"node_modules/webpack-cli/node_modules/@discoveryjs/json-ext": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-1.1.0.tgz",
"integrity": "sha512-Xc3VhU02wqZ1HvHRJUwL09HkZSTvidqY5Ya0NXBSYOxAp+Ln9dcJr9fySI+CkONzP3PekQo9WdzCv0PGER/mOA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.17.0"
}
},
"node_modules/webpack-cli/node_modules/commander": {
"version": "14.0.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
"integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=20"
}
},
"node_modules/webpack-cli/node_modules/interpret": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",
"integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/webpack-cli/node_modules/rechoir": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz",
"integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"resolve": "^1.20.0"
},
"engines": {
"node": ">= 10.13.0"
}
},
"node_modules/webpack-dev-middleware": { "node_modules/webpack-dev-middleware": {
"version": "7.4.5", "version": "7.4.5",
"resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.5.tgz", "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.5.tgz",

3
package.json

@ -208,7 +208,8 @@
"ts-jest": "29.4.0", "ts-jest": "29.4.0",
"ts-node": "10.9.2", "ts-node": "10.9.2",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "5.9.2" "typescript": "5.9.2",
"webpack-cli": "7.1.0"
}, },
"engines": { "engines": {
"node": ">=22.18.0" "node": ">=22.18.0"

Loading…
Cancel
Save