-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cannot find module in build process #203
Comments
Same with me, can't build svg sprite |
Also getting this. Using Edit: To clarify, the project build just fine and is able to find all images if use a regular string as |
I've fixed this project with alias: module.exports = withFonts(
withOptimizedImages(
{
webpack: (config) => {
config.resolve.alias['@public'] = path.resolve(__dirname, 'public');
return config;
},
}
)
); Then you can do |
having the same issue with nextJS 10 |
Hi guys,
I have an issue with the build process.
What I am trying to do, is to save some images from API to my project. I am using the
file stream
in thegetStaticProps
function to achieve that.Then in my page, I require the image that is saved previously:
<img src={require('../../../public/images/hero/my-image.jpg?webp')} />
In my first build, I get the error:
Error: Cannot find module './my-image.jpg'
If I build again everything works fine because the image is already there.
I tried to check if the image exists before the return in
getStaticProps
usingfs.existsSync(file)
and my file exists.Any ideas on the above error or any hints? Thanks
The text was updated successfully, but these errors were encountered: