Skip to content

@nx/webpack - Migrations

The @nx/webpack plugin provides various migrations to help you migrate to newer versions of webpack projects within your Nx workspace. Below is a complete reference for all available migrations.

update-23-0-0-remove-nx-tsconfig-paths-webpack-plugin-import

Section titled “update-23-0-0-remove-nx-tsconfig-paths-webpack-plugin-import”

Version: 23.0.0-beta.10

Rewrites imports of NxTsconfigPathsWebpackPlugin from ‘@nx/webpack’ to the sub-path ‘@nx/webpack/tsconfig-paths-plugin’.

Rewrite NxTsconfigPathsWebpackPlugin Imports to the @nx/webpack/tsconfig-paths-plugin Sub-path

Section titled “Rewrite NxTsconfigPathsWebpackPlugin Imports to the @nx/webpack/tsconfig-paths-plugin Sub-path”

The deprecated re-export of NxTsconfigPathsWebpackPlugin from @nx/webpack is removed in v23. The migration rewrites both ES module imports and CJS require() calls to use the @nx/webpack/tsconfig-paths-plugin sub-path. Imports that combine the deprecated symbol with other named imports are split into two declarations so the rest of the original import still resolves from @nx/webpack. Aliases (as Plugin, : Plugin) are preserved.

ES module import.

apps/my-app/webpack.config.ts
import { NxTsconfigPathsWebpackPlugin } from '@nx/webpack';
export default { plugins: [new NxTsconfigPathsWebpackPlugin()] };
apps/my-app/webpack.config.ts
import { NxTsconfigPathsWebpackPlugin } from '@nx/webpack/tsconfig-paths-plugin';
export default { plugins: [new NxTsconfigPathsWebpackPlugin()] };

ES module import combined with other named imports.

apps/my-app/webpack.config.ts
import { NxTsconfigPathsWebpackPlugin, NxAppWebpackPlugin } from '@nx/webpack';
apps/my-app/webpack.config.ts
import { NxTsconfigPathsWebpackPlugin } from '@nx/webpack/tsconfig-paths-plugin';
import { NxAppWebpackPlugin } from '@nx/webpack';

CJS require().

apps/my-app/webpack.config.js
const { NxTsconfigPathsWebpackPlugin } = require('@nx/webpack');
apps/my-app/webpack.config.js
const {
NxTsconfigPathsWebpackPlugin,
} = require('@nx/webpack/tsconfig-paths-plugin');

Version: 23.0.0-beta.24

Rewrites @nx/webpack/src/* subpath imports now that the ./src/* subpath is no longer exposed by @nx/webpack’s exports map. Named imports/exports of public symbols are routed to @nx/webpack and the rest to the new @nx/webpack/internal entry; require, dynamic import and jest.mock calls reference the whole module and are routed to @nx/webpack/internal.

update-23-0-0-migrate-create-nodes-v2-import

Section titled “update-23-0-0-migrate-create-nodes-v2-import”

Version: 23.0.0-beta.24

Rename imports of createNodesV2 from @nx/webpack/plugin to the canonical createNodes export.

Rename createNodesV2 imports to createNodes

Section titled “Rename createNodesV2 imports to createNodes”

@nx/webpack renamed its primary inferred-plugin export from createNodesV2 to createNodes. The createNodesV2 name is preserved as a deprecated alias for now, but new code should use createNodes.

This migration scans every .ts, .tsx, .cts, and .mts file in your workspace and rewrites named imports and re-exports of createNodesV2 from @nx/webpack/plugin to createNodes.

import { createNodesV2 } from '@nx/webpack/plugin';
import { createNodes } from '@nx/webpack/plugin';

Aliases are preserved (createNodesV2 as cn becomes createNodes as cn), and if a file already imports both names ({ createNodes, createNodesV2 }) the redundant binding is dropped.

Only static import/export named bindings from @nx/webpack/plugin are rewritten. Namespace imports, dynamic import(...), require(...) destructuring, and property access such as plugin.createNodesV2 are left untouched — they keep working through the createNodesV2 runtime alias. Update those by hand if you want to drop the deprecated name everywhere.

Version: 23.0.0-beta.24

The following packages will be updated:

NameVersionAlways add to package.json
webpack^5.101.3Added if not installed
webpack-dev-server^5.2.1Added if not installed
webpack-cli^7.0.0Added if not installed

Version: 22.0.0-beta.0

Remove deprecated deleteOutputPath and sassImplementation options from @nx/webpack:webpack

Version: 21.5.0-beta.0

The following packages will be updated:

NameVersionAlways add to package.json
webpack5.101.3Updated only

Version: 21.0.0-beta.11

Remove isolatedConfig option for @nx/webpack:webpack

The isolatedConfig option is no longer supported by the @nx/webpack:webpack executor. Previously, setting isolatedConfig: false allowed you to use the executor’s built-in Webpack configuration.

If this option is set in project.json, then it will be removed in favor of an explicit webpackConfig file. The Webpack configuration file matches the previous built-in configuration of the @nx/webpack:webpack executor.

project.json
{
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"options": {
"isolatedConfig": false
}
}
}
}
project.json
{
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"options": {
"webpackConfig": "apps/myapp/webpack.config.js"
}
}
}
}