Next.js Discord

Discord Forum

Turbopack import JSON from outside project root

Unanswered
Spinge Bib Sqorpnts posted this in #help-forum
Open in Discord
Avatar
Hello, I am attempting to import a JSON file that resides outside the project folder, and it works perfectly without the --turbo flag.

Snippet:
locale is a state string.
import(`C:/inetpub/wwwroot/Translation/${locale}.json`)
  .then((msgs) => 
  {
    setMessages(msgs.default);
  })
  .catch((e) => console.error('Failed to load messages:', e));

2 Replies

Avatar
When I run next dev --turbo, it throws a Module not found error