Next.js Discord

Discord Forum

How do you exclude a folder from next build?

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
foo/
  problem-file.ts # causes type error
src/
  ..

Linting and checking validity of types.
Failed to compile.

I'd like to just completely ignore the foo/ folder from any checks during next build
Adding "ignorePatterns": ["foo"] to .eslintrc does not seem to have any effect although this seems to be the suggested approach that i've found.

10 Replies

Caribbean Elaenia
You can add "rootDir": "src" [Replace "src" with the only folder you want it to read]
It's "src" folder in your case
It's gonna exclude all folders except src
In tsconfig.json
Or you can also add your folder in "exclude"
@Caribbean Elaenia Or you can also add your folder in "exclude"
Barbary LionOP
that didn't work either
i had some input that seems to help...
by removing the tsconfig compilerOptions "noUnusedLocals": true, i can swap to an eslint rule such as no-unused-vars, and the ignorePattern now works
Caribbean Elaenia
Great
Does it work now?
Barbary LionOP
the build process is moving forward at least. i'm hoping there's a cleaner solution still