I am working on react based nextjs app. Some npm packages are using external css import. I am getting error like
Module parse failed, you may need an appropriate loader to handle this file type.
How can I support css import from external packages in my nextjs app. I have checked somewhere by making change in next.config.js, it works. But I am unable to find the proper one.It would be great if someone can help me around this.
You first need to create a next.config.js
file in root directory
Install next-css
npm i @zeit/next-css
in next.config.js
const withCSS = require('@zeit/next-css')
module.exports = withCSS()
Restart app
USAGE
import 'react-select/dist/react-select.css'
No need for dangerouslySetInnerHTML