Skip to main content
Version: Current (v7.0.0-beta.3)

Imports from a package's lib folder no longer resolve

Detect​

  • @rjsf/<package>/lib or @rjsf/<package>/lib/<file>.js in your code.
  • Node throws ERR_PACKAGE_PATH_NOT_EXPORTED for one of those imports, or your bundler fails to resolve it.
  • Type checker under node16, nodenext or bundler resolution: Cannot find module '@rjsf/<package>/lib/<file>.js' or its corresponding type declarations.
  • A tool that reads @rjsf/snapshot-tests/package.json.

Change​

An import of a path the package's exports doesn't list now fails in Node, in every bundler and in each TypeScript resolution that reads exports. A tool that ignores exports, such as webpack 4 or TypeScript's node10 resolution, still finds the file, but nothing there is part of the public API.

These still resolve:

  • each package's root, such as @rjsf/core or @rjsf/utils;
  • @rjsf/core/markdown, @rjsf/core/testing, @rjsf/core/rjsf.css and @rjsf/core/rjsf-theme.css;
  • @rjsf/validator-ajv8/compileSchemaValidators and @rjsf/validator-ata/compileSchemaValidators, see compileSchemaValidators is imported from its own subpath.

Most deep imports name something the package root exports too, so import it from there:

-import SchemaField from '@rjsf/core/lib/components/fields/SchemaField.js';
-import { getUiOptions } from '@rjsf/utils/lib/getUiOptions.js';
+import { SchemaField } from '@rjsf/core';
+import { getUiOptions } from '@rjsf/utils';

@rjsf/core now exports GridType, Operators, LAYOUT_GRID_OPTION, LAYOUT_GRID_UI_OPTION and the GridProps, GridSchemaType, LayoutGridSchemaType and LayoutGridFieldProps types, which only lib/components/fields/LayoutGridField.js used to export. @rjsf/utils now exports getMatchingPatternProperties(), which only lib/schema/retrieveSchema.js used to export. Label from lib/components/templates/FieldTemplate/Label.js is exported as FieldLabel, see core's Label is exported as FieldLabel.

These have no import path any more:

Verify​

  • No code imports an @rjsf/* path outside the list above.
  • Your build, tests and type checker resolve every @rjsf/* import.

Also read: