"Cannot resolve module 'fs'" inside static component methods #14490
Unanswered
CarsonMcKinstry
asked this question in
Help
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
Describe the bug
When attempting to import
fs
inside a static method on a component, we are met with the messageCannot resolve module 'fs' in ...
.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
git clone https://github.com/CarsonMcKinstry/next-fs-bug
cd next-fs-bug
yarn build
Expected behavior
The
fs
module to be available.System information
Additional context
We are using some custom prop initializers in
pages
in order to handle pulling in translation data from the file system. This is handled as a static method on a provider component, which imports thefs
module and gets the translation data from the file system. The example I've provided simply attempts to read from the current directory, but is essentially what we are doing in our app.Beta Was this translation helpful? Give feedback.
All reactions