Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Use with nextjs? #46

Open
abumalick opened this issue Dec 17, 2020 · 0 comments
Open

[Question] Use with nextjs? #46

abumalick opened this issue Dec 17, 2020 · 0 comments

Comments

@abumalick
Copy link

abumalick commented Dec 17, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant