I want to serve static file in my Next.js app and it is throwing me an error each time it wants to use import fs from 'fs';
I'm supposed not obligated to yarn add fs in order to use fs, why is it giving me this?
My next.config.js is pretty much empty:
const nextTranslate = require('next-translate');
module.exports = {
...nextTranslate(),
};
My current dynamic post page is:
/** @format */
import fs from 'fs';
export default function Doc() {
return <div>Enter</div>;
}
export const getStaticPaths = async () => {
return {
paths: [],
fallback: false,
};
};
Still I get this error:
I even tried to start a new project and it fails too once I try to use fs. Does it needs to be installed globally in my computer? I have node (v14.15.1) installed for sure.
question from:
https://stackoverflow.com/questions/65846964/cannot-resolve-fs-on-static-generate-project 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…