Next.js Discord

Discord Forum

Module parse failed: Unexpected token with typescript files

Unanswered
Indigo Bunting posted this in #help-forum
Open in Discord
Indigo BuntingOP
I use nx and have the next structure of project:

apps
-- web
----src
------...
----next.config.js (see screen)
----next-env.d.ts
----package.json
----tsconfig.json
libs
--email
----src
------...
package.json
nx.json
tsconfig.json


In web app I used email component from libs/email and all work correctly.
Today I should add React context to libs/email components

When I did that next.js throw exeption that I should use "use client;" if I want use createContext (see screen).
I added it to my libs/email component but after it next.js can't compile ts files from libs/email and throw exeptions (see screen)

Could somebody to help me with it?

0 Replies