After researching, I've come to realize that this issue is common among developers. Unfortunately, none of the solutions I found have worked for me.
During npm run dev mode, everything in the project functions as expected, with all imports working seamlessly.
import { Typography } from "@material-ui/core";
import Card from 'react-bootstrap/Card'
For example, in a page, the imports work smoothly; however, as soon as I run npm build and visit the page, the imports seem to fail, resulting in no CSS applied.
Below is the content of my next.config.js file:
const withCSS = require('@zeit/next-css')
module.exports = withCSS({
cssLoaderOptions: {
url: false
}
})
I have attempted to include MaterialUI and React-Bootstrap, but my efforts have been unsuccessful.
Any assistance in resolving this issue would be greatly appreciated. I'm puzzled as to why the build is failing.
Here is the content of my package.json file:
{
"name": "name",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"prod": "next export"
},
"dependencies": {
"@material-ui/core": "^4.8.2",
"@material-ui/icons": "^4.5.1",
"@zeit/next-css": "^1.0.1",
"bootstrap": "^4.4.1",
"next": "9.1.6",
"next-compose-plugins": "^2.2.0",
"nextjs-sitemap-generator": "^0.4.2",
"react": "16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "16.12.0",
"styled-components": "^4.4.1"
}
}