nodejs-infer
Options controlling which dependencies will be inferred for javascript targets.
Backend: pants.backend.experimental.javascript.lint.prettier
Config section: [nodejs-infer]
Basic options
imports
--[no-]nodejs-infer-imports
PANTS_NODEJS_INFER_IMPORTS
[nodejs-infer]
imports = <bool>
True
Infer a target's imported dependencies by parsing import statements from sources.
To ignore a false positive, you can either put // pants: no-infer-dep
on the line of the import or put !{bad_address}
in the dependencies
field of your target.
package_json_entry_points
--[no-]nodejs-infer-package-json-entry-points
PANTS_NODEJS_INFER_PACKAGE_JSON_ENTRY_POINTS
[nodejs-infer]
package_json_entry_points = <bool>
True
Infer a package_json
's dependencies by parsing entry point statements from the package.json file.
To ignore a false positive, you can put !{bad_address}
in the dependencies
field of the package_json
target.
See https://nodejs.org/api/packages.html#package-entry-points and https://docs.npmjs.com/cli/v9/configuring-npm/package-json#browser.
unowned_dependency_behavior
--nodejs-infer-unowned-dependency-behavior=<UnownedDependencyUsage>
PANTS_NODEJS_INFER_UNOWNED_DEPENDENCY_BEHAVIOR
[nodejs-infer]
unowned_dependency_behavior = <UnownedDependencyUsage>
error, warning, ignore
default:
warning
How to handle imports that don't have an inferrable owner.
Usually when an import cannot be inferred, it represents an issue like Pants not being properly configured, e.g. targets not set up. Often, missing dependencies will result in confusing runtime errors like Error: ENOENT: no such file or directory
, so this option can be helpful to error more eagerly.
To ignore any false positives, add // pants: no-infer-dep
to the line of the import
Advanced options
None
Deprecated options
None
Related subsystems
None