Turbopack import JSON from outside project root
Unanswered
Spinge Bib Sqorpnts posted this in #help-forum
Hello, I am attempting to import a JSON file that resides outside the project folder, and it works perfectly without the
Snippet:
locale is a state string.
--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
When I run
next dev --turbo
, it throws a Module not found
error@Spinge Bib Sqorpnts 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.
ts
import(`C:/inetpub/wwwroot/Translation/${locale}.json`)
.then((msgs) =>
{
setMessages(msgs.default);
})
.catch((e) => console.error('Failed to load messages:', e));
If it works without turbopack and fails with turbopack, that’s turbopack’s bug so (1) please report it as a bug and (2) you can’t do anything other than going back to webpack