On our Next.js project we have a git submodule that contains UI components shared between multiple projects. Some of the components are not used in my project, and rely on libraries that are not currently installed in my project. To avoid installing these libraries, I’d like to exclude the unneeded components from the build. How can I do that?
For some reason, Next.js tries to build everything, even though the components not included anywhere in the project, they’re just located in the /src/our-ui-submodule
folder.
I tried adding this to tsconfig.json
, but it didn’t help:
"exclude": ["node_modules", "src/our-ui-submodule/UnneededComponent.tsx"]
2