uiwjs / next-remove-imports

The default behavior is to remove all .less/.css/.scss/.sass/.styl imports from all packages in node_modules.
https://uiwjs.github.io/next-remove-imports/
MIT License
17 stars 2 forks source link

How to use with "next-compose-plugins" #10

Closed muzlevy closed 1 year ago

muzlevy commented 1 year ago

hello, I would like to know if they can be used together

This is my next.config.js

const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
const withLess = require("next-with-less");
const withTM = require("next-transpile-modules")([
  "jotai",
  "yup",
  "overlayscrollbars",
  "overlayscrollbars-react",
  "react-hook-form"
]);
module.exports = withPlugins([withTM, withImages, withLess], {
  images: {
  disableStaticImages: true,
  },
  webpack: (config, options) => {
  return config;
  },
});
jaywcjlove commented 1 year ago

@muzlevy https://github.com/uiwjs/next-remove-imports/tree/main/example

muzlevy commented 1 year ago

@muzlevy https://github.com/uiwjs/next-remove-imports/tree/main/example

Thank you for your answer, I've already solved this problem

GaNiziolek commented 9 months ago

@muzlevy can you share with us how you solve this?

muzlevy commented 9 months ago

@muzlevy can you share with us how you solve this?

I use spread syntax

const withPlugins = require("next-compose-plugins");
const removeImports = require("next-remove-imports");

module.exports = withPlugins([withTM, withImages], {
  images: {
    disableStaticImages: true,
  },
  webpack: (config, options) => {
    return config;
  },
  ...removeImports({
    test: /node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/,
    matchImports: "\\.(less|css|scss|sass|styl)$",
  }),
});