With the latest update to @mittwald/flow-react-components
, the way package
exports are handled has changed. You no longer need to specify subdirectories
explicitly when importing components and utilities. Instead, imports are now
structured in a more streamlined way.
Previously, you had to import components and utilities from specific subdirectories, like this:
import Button from "@mittwald/flow-react-components/Button";
import { useOverlayController } from "@mittwald/flow-react-components/controller";
import Field from "@mittwald/flow-react-components/react-hook-form/Field";
import { Link } from "@mittwald/flow-react-components/react-hook-form/nextjs";
With the new package structure, the same imports should be rewritten as follows:
import { Button } from "@mittwald/flow-react-components";
import { useOverlayController } from "@mittwald/flow-react-components";
import { Field } from "@mittwald/flow-react-components/react-hook-form";
import { Link } from "@mittwald/flow-react-components/nextjs";
Set "module": "esnext"
in your tsconfig.json
, if you have trouble with
missing module exports.
npx jscodeshift \
-t https://raw.githubusercontent.com/mittwald/flow/refs/heads/main/packages/codemods/src/transforms/flow020.ts \
--parser tsx \
src
Replace src
with your sources folder. If you do not use TypeScript in your
project, use --parser jsx
.
See the docs of jscodeshift
- Update all import statements in your project according to the new structure.
- Remove unnecessary subdirectory paths from imports.
- Verify your application still compiles and runs correctly.
- Run your test suite to ensure no regressions were introduced by the migration.
- Simplified import statements with a clearer structure.
- Better maintainability as package updates no longer require path modifications.
- Improved autocompletion support in modern IDEs.
The CSS export @mittwald/flow-react-components/styles
has renamed to the more
precise name @mittwald/flow-react-components/all.css
, because the file
contains the CSS of all components, and now there are CSS exports per component
as well. A documentation on how to use them is planned.
// main.js
- import "@mittwald/flow-react-components/styles";
+ import "@mittwald/flow-react-components/all.css";