Bundling and Import
This reference covers bundling your React components and importing them to Webflow.
Import
Import your components to Webflow using DevLink. DevLink bundles your component files and uploads them to your Workspace as a shared library.
Use the following command to import your components to Webflow:
CI/CD pipelines
For automated workflows, add the --no-input flag to skip interactive prompts:
Important: Add change detection to prevent inadvertently removing components:
- Compare current library state with previous import
- Only share when components have actually changed
webflow devlink import and webflow devlink bundle exit with 0 on success. Treat any non-zero exit code as a failure.
To check that your library builds without sharing it, for example on every pull request, run webflow devlink import --dry-run --no-input. See Import in the CLI reference.
For more options, see the Webflow CLI reference. →.
Bundling
Webflow uses Webpack to bundle your component libraries. During this process, the bundler handles TypeScript compilation, resolves all dependencies and imports, optimizes your code for production, and generates bundles ready for import.
The default configuration handles most use cases automatically. Extend it when you need:
- Custom CSS processing
- Specialized file handling (SVG, images, fonts)
- Build optimizations (tree shaking, code splitting)
To override the default configuration, see the guide on Webpack configuration overrides.
If you’re using a CSS framework or component library, you may need to configure your project to handle the framework’s CSS. See the frameworks and libraries guide for more information.
Bundle limits
The maximum bundle size is 50 MB. Component count alone doesn’t determine bundle size, it also depends on dependencies and bundled assets in the library.
Run the local bundle command to see the total size of your generated files. Check how that size changes when you add dependencies or large assets, such as images and fonts.
Debugging
This section provides common debugging techniques for troubleshooting the bundling process and resolving configuration issues.
Disable minification
By default, the bundler minifies your code to reduce file size for production. To troubleshoot issues, you can disable minification in your webpack configuration.
This keeps your bundled code readable and ensures that any errors you see in the browser’s developer console will have accurate line numbers that map back to your original source code.
When using a custom webpack configuration file, you must include the file in your webflow.json file by passing the path to the file in the bundleConfig property.
Multiple copies of React
Code components only render when the whole bundle uses a single copy of React. Two copies build without errors, but every component then crashes in the Webflow Designer with React error #525 or “Invalid hook call”. A dependency that installs its own copy of react, or react and react-dom at different versions, causes this.
The CLI resolves react and react-dom from the folder that contains your manifest file. If the bundler still finds more than one copy, or the versions don’t match, the build fails and lists where each copy comes from. For example:
To fix it:
- Install
reactandreact-domin the folder that contains your manifest file, or make sure your package manager hoists them there. - Use the same version of
reactandreact-dom. See React and React DOM for the version rules. - Align the versions in your
package.jsonfiles, or pin one version with your package manager’soverrides(npm),resolutions(Yarn), orpnpm.overrides(pnpm). Then reinstall your dependencies.
The --force flag doesn’t skip this check, because the bundle would crash in the Designer anyway.
CSS modules
CSS Modules scope styles by generating unique class names, preventing conflicts between components.
By default, you must use bracket notation to access CSS classes:
To enable dot notation, and to use the default import syntax for CSS modules, update the css-loader configuration:
Bundle locally
To test and debug your React components locally, you can bundle your library using the Webflow CLI command.
The public path is the URL where you can serve your bundled library. The CLI will generate a dist folder with your bundled library.
To inspect the final configuration being used by webpack, use the --debug-bundler option.