Skip to content

[Question] Use with nextjs? #46

Description

@abumalick

Any idea how to make this loader work with nextjs?

I tried the following in next.config.js based on the old example from https://github.com/vercel/next.js/pull/9910/files

const withSass = require("@zeit/next-sass");
const withCss = require("@zeit/next-css");

module.exports = withCss(
  withSass({
    cssModules: true,
    webpack(config, options) {
      if (!options.isServer) {
        options.defaultLoaders.sass = [
          options.defaultLoaders.sass[0],
          options.defaultLoaders.sass[1],
          "@teamsupercell/typings-for-css-modules-loader",
          options.defaultLoaders.sass[2],
          options.defaultLoaders.sass[3],
        ];
        console.log(options.defaultLoaders.sass);
      }
      return config;
    },
  })
);

The console.log gives me this:

  'extracted-loader',
  '/path/to/my_app/node_modules/mini-css-extract-plugin/dist/loader.js',
  '@teamsupercell/typings-for-css-modules-loader',
  {
    loader: 'css-loader',
    options: {
      modules: true,
      minimize: false,
      sourceMap: true,
      importLoaders: 1
    }
  },
  { loader: 'sass-loader', options: {} }
]

But it does not generate any typings for my scss files.

I will be happy to push a reproduction repo if anyone wants to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions