Trying to deploy my site on Netlify from this GitHub repository: https://github.com/Koda-Pig/joshkoter.com, but encountering an error:
10:02:31 AM: Module not found: Can't resolve '../styles/home.module.css' in '/opt/build/repo/pages'
10:02:31 AM: > Build failed because of webpack errors
The contents of my next.config.json file are as follows:
module.exports = {
reactStrictMode: true
}
const withVideos = require('next-videos')
module.exports = withVideos()
Next.js documentation mentions built-in support for CSS modules, and Netlify has not had issues with other CSS modules I have used. Unsure why the webpack error is occurring.
Tried adding a CSS loader to next.config.js like this:
module.exports = {
reactStrictMode: true,
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
}
}
const withVideos = require('next-videos')
module.exports = withVideos()
Also attempted with the following configuration:
module.exports = {
reactStrictMode: true,
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
],
},
}
const withVideos = require('next-videos')
module.exports = withVideos()
However, the same error persisted. This being my first experience deploying a Next.js site on Netlify, any guidance would be highly appreciated.
Thank you for your assistance.