Heavy, Engine, Ear
HeavyEngineer
Published on

How to get react-tag-input working with Nextjs 13

I need to add react-tag-input to nextjs 13.

This post got me underway usage with nextjs12 + react18

However the next-transpile-modules functionality is now integrated into nextjs13

Here is the code that will get this component working. Add this to your next.config.js:

const nextConfig = {
  reactStrictMode: true,
  transpilePackages: [
    ("react-tag-input",
    "react-dnd",
    "dnd-core",
    "@react-dnd/invariant",
    "@react-dnd/asap",
    "@react-dnd/shallowequal"),
  ],
};

Now all the modules in the 'transpilePackages' array will be availble to NextJs.