Skip to content

uiwjs/next-remove-imports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using my app is also a way to support me:
Scap: Screenshot & Markup Edit Screen Test Deskmark Keyzer Vidwall Hub VidCrop Vidwall Mousio Hint Mousio Musicer Audioer FileSentinel FocusCursor Videoer KeyClicker DayBar Iconed Menuist Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

next-remove-imports

Buy me a coffee Follow On X NPM Downloads Build & Deploy Repo Dependents

This is a plugin for nextjs. The default behavior is to remove all .less/.css/.scss/.sass/.styl imports from all packages in node_modules.

Warning CSS Imported by a Dependency #52

Install

npm install next-remove-imports
# or
yarn add next-remove-imports

Usage

// next.config.mjs
import removeImports from 'next-remove-imports'

/** @type {function(import("next").NextConfig): import("next").NextConfig}} */
const removeImportsFun = removeImports({
  // test: /node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/,
  // matchImports: "\\.(less|css|scss|sass|styl)$"
});

export default removeImportsFun({
  webpack(config, options) {
    return config
  },
});
// next.config.js
const removeImports = require('next-remove-imports')({
  options: { },
})
module.exports = removeImports()
// next.config.js
const removeImports = require('next-remove-imports')()
module.exports = removeImports({
  webpack(config, options) {
    return config
  },
});
// next.config.js
const removeImports = require('next-remove-imports')({
  test: /node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/,
  matchImports: "\\.(less|css|scss|sass|styl)$"
});

module.exports = removeImports({
  webpack(config, options) {
    return config
  },
});
// next.config.js
const removeImports = require('next-remove-imports')();

module.exports = (phase, { defaultConfig }) => {
  return removeImports({
    ...defaultConfig
  });
};

Options

export type PluginOptions = {
  /**
   * @default "/node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/"
   */
  test?: RegExp;
  /**
   * @default "\\.(less|css|scss|sass|styl)$"
   */
  matchImports?: string;
}

License

Licensed under the MIT License.

About

The default behavior is to remove all .less/.css/.scss/.sass/.styl imports from all packages in node_modules.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors