Я несколько раз пытался подключить мои next.js и scss, но это не работает.
Я думал, что настроил все для компиляции моего файла с scss.
Ошибкаговоря, что
/scss/style.scss 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> .example {
| color: blue;
| }
вот код:
next.config.js
const withSass = require("@zeit/next-sass");
module.exports = withSass();
_document.js
import Document, { Head, Main, NextScript } from "next/document";
export default class extends Document {
render() {
return (
<html>
<Head>
<link rel="stylesheet" href="/_next/static/style.css" />
<Head />
<body>
<Main />
<div id="modal" />
<NextScript />
</body>
</html>
);
}
}
index.js
import "../scss/style.scss";
import axios from "axios";
const Index = props => {
return (
<div>
<div className="example">hello</div>
<header>
<Header />
</header>
<section>
<Body stores={props.data} />
</section>
<footer>
<Footer />
</footer>
</div>
);
};
style.scss в папке SCSS
.example {
color: blue;
}