fix(repo): use import type for type-only @nx/devkit imports in copy-a…#35897
Merged
Conversation
…ssets plugin CreateNodesV2 and TargetConfiguration are types but were imported as values. The @nx/workspace-plugin package is type: module, so under Node's native TypeScript stripping (Node >= 22.18) those names are left as runtime imports. @nx/devkit is CommonJS with no such runtime exports, so the plugin fails to load -- surfacing on the FreeBSD publish job as the misleading "imported again after being required. Status = 0" Node error. Marking them import type lets native strip erase them so the plugin loads on any Node.
Contributor
|
View your CI Pipeline Execution ↗ for commit 0f42557
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
AgentEnder
approved these changes
Jun 5, 2026
…Syntax @nx/workspace-plugin is type: module, so Nx loads its .ts files through Node's native type stripping, which can't erase a type imported as a value -- the plugin then fails to load (surfacing as the misleading "imported again after being required. Status = 0" on the swc-less FreeBSD publish job). Align the lib build to ESM (module/moduleResolution: nodenext) and enable verbatimModuleSyntax so a type-as-value import fails the build instead of only at runtime, and convert the remaining offenders to import type: ExecutorContext, ConformanceViolation (x2), and Tree (x2). This complements the copy-assets-plugin import type fix and prevents the whole class of bug from regressing across the package.
vrxj81
pushed a commit
to vrxj81/nx
that referenced
this pull request
Jun 7, 2026
nrwl#35897) …ssets plugin CreateNodesV2 and TargetConfiguration are types but were imported as values. The @nx/workspace-plugin package is type: module, so under Node's native TypeScript stripping (Node >= 22.18) those names are left as runtime imports. @nx/devkit is CommonJS with no such runtime exports, so the plugin fails to load -- surfacing on the FreeBSD publish job as the misleading "imported again after being required. Status = 0" Node error. Marking them import type lets native strip erase them so the plugin loads on any Node. <!-- 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 #
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ssets plugin
CreateNodesV2 and TargetConfiguration are types but were imported as values. The @nx/workspace-plugin package is type: module, so under Node's native TypeScript stripping (Node >= 22.18) those names are left as runtime imports. @nx/devkit is CommonJS with no such runtime exports, so the plugin fails to load -- surfacing on the FreeBSD publish job as the misleading "imported again after being required. Status = 0" Node error. Marking them import type lets native strip erase them so the plugin loads on any Node.
Current Behavior
Expected Behavior
Related Issue(s)
Fixes #