So I've read around and I can see this is a common thing but sadly all the solutions I could find didn't work out for me.
When in npm run dev mode the project is fine, all my imports work.
import { Typography } from "@material-ui/core";
import Card from 'react-bootstrap/Card'
example of how I import in a page, but the second I npm run build and go to the page, it seems these imports fail and I just get no CSS off them.
This is my next.config.js file
const withCSS = require('@zeit/next-css')
module.exports = withCSS({
cssLoaderOptions: {
url: false
}
})
I would assume I need to give it materialUI & react-bootstrap? my attempts on that have failed.
Any help on this would be greatly appreciated, not sure why it wouldn't build.
Here is my package.json
{
"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"
}
}
npm run buildandnpm start. And everything runs well onhttp://localhost:3000. Here is a pull request I made showing you what I changed github.com/Cobwebster/SuffolkDaily/pull/1