Nx
WebStorm integrates with the Nx build system optimized for monorepos with built-in tooling for code scaffolding, module boundary enforcement, automated updates and advanced CI capabilities with caching and distribution.
WebStorm provides you with a dedicated Nx Console tool window and an Nx run/debug configuration for running and debugging your scripts.
If you are using Karma for testing, you can also specify the Nx package as Karma package in Karma run/debug configurations.
Before you start
Make sure you have Node.js on your computer.
Install and enable the Nx Console plugin on the Settings | Plugins page, tab Marketplace, as described in Installing plugins from JetBrains Marketplace.
Create an NX workspace
Click New Project on the Welcome screen or select from the main menu. The New Project dialog opens.
In the left-hand pane, choose Nx.
In the right-hand pane:
Specify The path to the folder where the project-related files will be stored.
In the Node Interpreter field, specify the Node.js interpreter to use. Select a configured interpreter from the list or choose Add to configure a new one.
From the Command list, select npx create-nx-workspace @latest.
Click Create and answer the questions in the wizard. Based on these answers, a workspace is created and set up.
Click the link to go to the authorization page.
Nx console tool window
The Nx Console tool window provides you with information about your workspace. It lists all your projects and the targets that can be run for them, such as build
, serve
, test
, lint
, and any configuration you have set up.
From the context menu of a target, you can run or debug the target as well as edit the dedicated run/debug configuration for it.
To open the Nx Console tool window, click
on the sidebar or go to on the main menu.To view a list of the projects and targets shown, click Refresh Workspace or click on the toolbar of the tool window.
Run and debug Nx targets
You can run and debug Nx targets from the Nx Console tool window or via a dedicated Nx run/debug configuration.
Run targets
In the Nx Console tool window, select a target and then select Run '<target_name>' from its context menu.
From the Run widget on the toolbar, select the configuration with the name of the target and click next to it.
Debug targets
Set the breakpoints in your script where necessary.
In the Nx Console tool window, select a target and then select Debug '<target_name>' from its context menu.
Alternatively, from the Run widget on the toolbar, select the configuration with the name of the target and click next to it.
Edit run/debug configurations for targets
Do one of the following:
In the Nx Console tool window, select a target and then select Edit '<target_name> from its context menu.
From the Run widget on the main toolbar, select Edit Configurations, and then select the appropriate configuration from the list.
The Edit run/debug configuration: <target name> dialog opens.
Update the default auto-generated settings and save the run/debug configuration.