Framer
  • Support
  • Using Framer
Framer
  • Learn
    • Speedruns
    • Starter Kit
    • Examples
    • Tutorials
    • Sessions
  • Teams
    • Teams
    • Enterprise
  • Pricing
  • Blog
  • Updates
  • Support
  • Support
  • Using Framer

Related Articles

  • Authenticating with a Framer Token
  • Importing from Figma
  • Getting existing React components on your canvas
  • Using Framer animations in production
  • Importing a React Design System

Using NPM packages in Framer

Note: This article refers to the Framer desktop app. Learn more about the differences between the Framer web and desktop app here.

This article uses Framer’s code features. Find out how to enable code features in your project.

Framer uses NPM with Yarn to manage all dependencies. You can easily install any external dependency as you would with other JavaScript projects.

Adding packages with Yarn

Make sure you're using a folder-backed project. Alternatively, you can open a .framerx file’s temporary location while the project is opened in Framer by selecting File Show Project Folder.

Use the terminal to navigate to your project location:

~ $ cd project.framerfx

Now you can install any NPM package using Yarn.

~/project.framerfx $ yarn add lodash @types/lodash

From here, the package will be added to the node_modules and package.json file. It will be available in all your code components and automatically installed as a dependency whenever a project gets opened.

TypeScript might require you to import modules into components different from what you’re used to. As a rule of thumb, you can try to import the entire module into your component by using the asterisk symbol:

import * as debounce from "lodash.debounce";

Learn more

Head over to the Learn page to find out more about installing external packages.

Private packages

To install packages from a private NPM registry, you can leverage your system-wide ~/.npmrc to set up the details of your registry.

As an example, let’s assume the private registry is set up at https://registry.acme.corp and all packages are prefixed using the @acme scope.

You can run the following commands in your terminal to then set up the private registry:

yarn config set registry https://registry.acme.corp/ --scope=@acme

yarn login --scope=@acme

Tip: we recommend using Yarn. If you do use npm, you may be asked to set a Framer Token. Find out more about this in this article.

After logging in, your private registry is set up and you will be able to install packages from your private registry:

~/project.framerfx $ yarn add @acme/library

Framer Web

It is currently not yet possible to install external dependencies from NPM using the web version of Framer.

For now we recommend working with the Framer desktop app, available under the Pro or Enterprise plan, to use NPM packages.

You can discuss this and other requested features over at Canny.

Helpful?Was this article helpful?

0

0

Framer

  • Updates
  • Pricing
  • Tutorials
  • Teams
  • Enterprise
  • Blog
  • Motion

Platforms

  • Web
  • macOS
  • iOS
  • Android
  • Figma Importing
  • Sketch Importing
  • User Testing
  • Desktop PrototypingNew

Resources

  • Examples
  • Sessions
  • SpeedrunsNew
  • Packages
  • Volt
  • API
  • State of Prototyping
  • Wireframing Tool
  • Mockup Tool
  • Dictionary

About

  • Loupe
  • Community
  • Company
  • Careers
  • Security

Support

  • Using Framer
  • Accounts
  • Contact

  • Twitter
  • Discord
  • Dribbble

Copyright © 2021 Framer B.V.

  • Security
  • Terms of Service
  • Privacy Statement