Stryxus
Stryxus

Reputation: 13

Next-Sass not compiling?

I have followed everything from nextjs's examples and i cant find anything wrong...

Error given by nextjs dev server

Above - FIXED

/ Current Issue /

Its like next-sass isnt being used when it goes through a .scss file, im not sure whats happening. If i remove the imports from my SCSS file, the same error is thrown for everything else in the file.

The page is being rendered now, but none of the SCSS is being deployed and my index.TSX is now throwing

'boot' is declared but its value is never read.ts(6133)

Next.config.js

const withTypescript = require("@zeit/next-typescript");
const withSass = require("@zeit/next-sass");

module.exports = withTypescript(), withSass();

index.tsx

import * as React from "react";
import * as ReactDOM from "react-dom";
import _ from "lodash";

import boot from "../node_modules/bootstrap/scss/bootstrap.scss"
import the from "../styles/theme_common.scss";
import MasterLayout from "../components/masterLayout.container";

If anyone could help me solve this, this has halted development :(

Upvotes: 1

Views: 5093

Answers (2)

evgeni fotia
evgeni fotia

Reputation: 4810

The problem is how you are exporting multiple modules try this

const withTypescript = require("@zeit/next-typescript");
const withSass = require('@zeit/next-sass')
module.exports = withTypescript(withSass({
    cssModules: true
}))

and do import "../styles/theme_common.scss"; the same for the rest

Upvotes: 2

Francis
Francis

Reputation: 1904

The documentation seems to show a slightly different syntax for adding SASS Support with CSS.

https://github.com/zeit/next-plugins/tree/master/packages/next-sass#with-css-modules

// next.config.js
const withSass = require('@zeit/next-sass')
module.exports = withSass({
    cssModules: true
})

Upvotes: 0

Related Questions