outstatic: Module not found: Can't resolve 'fs'
I’m trying to add outstatic
to an existing project. Which is somewhat working. I can access the editor and also the collection creation is running. Currently, I’m struggling with the following issue:
./node_modules/.pnpm/outstatic@0.0.32-rc_3591a07f5f6bd7e95d5c3230e32ada50/node_modules/outstatic/dist/utils/server.js:1:716
Module not found: Can't resolve 'fs'
Import trace for requested module:
./pages/offers/[slug].jsx
It is the copy of the [slug].tsx
page of the blog example, so nothing new or special.
I can get rid of the error if I modify my next.config.js like that:
config.resolve.fallback = {
...config.resolve.fallback,
fs: false
};
But I get now paths or an empty array in the getStaticPaths
method:
export async function getStaticPaths() {
console.log(getDocumentPaths('offers')) // returns empty array
return {
paths: getDocumentPaths('offers'),
fallback: false
}
}
I’m pretty stuck cause with the empty array it is not dropping an error, but it is ending up constantly in 404 errors of existing pages.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (10 by maintainers)
I also used this config setting in the first place, which I don’t need to use anymore with the updated version 0.33-rc. But still, I get 404 errors in frontend for
.mdx
pages which are available inoutstatic/content/xyz
. I compared my site with the blog example up and down and can’t find any differences. There needs to be a minor tweak which is missing.