1.0.7 • Published 1 year ago

@pieced/style-config-webpack-plugin v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Automatically configuration webpack5 style loader

Install

npm i --save-dev @pieced/style-config-webpack-plugin

Webpack Config

const StyleConfigWebpackPlugin = require('@pieced/style-config-webpack-plugin');
module.exports = {
  plugins: [new StyleConfigWebpackPlugin()],
};

Options

cssModulesQuery

  • type string
  • default modules

usePostCSS

  • type boolean
  • default true

extract

  • type boolean or object
  • default
const defaultExtract = webpack.mode === 'production' && {
  filename: 'static/css/[contenthash:10].css',
  chunkFilename: 'static/css/[contenthash:10].css',
}

sourceMap

  • type boolean
  • default webpack.mode === 'development'

cssModulesName

  • type string
  • default webpack.mode === 'development' ? '[name]__[local]--[hash:base64:5]' : '_[hash:base64:10]'

generator

  • type function
  • default (suffix, loaders) => (webpack.mode === 'development' ? ['style-loader'].concat(loaders) : loaders)

minimizer

const defaultMinimizer = {
  minimizerOptions: {
    preset: ['default', {
      discardComments: {
        removeAll: true,
      },
    }],
  },
}