node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org ¬Ľ

webpack-blocks-more

webpack-blocks-more · npm

Just a few blocks that ūüď¶webpack-blocks is missing.

Designed to be used with webpack@3+ and webpack-blocks@1+.

Table of Content

API

setEnv([options])

Sets environmental variables to process.env and EnvironmentPlugin.

Arguments

  1. [options] (Array|Object): Any enumerable properties.

Example

setEnv({
  NODE_ENV: 'development',
  HOT: true,
})

watch([options])

Watch mode.

Arguments

  1. [options] (Object): See watchOptions for available properties.

parser([options])

Parser options.

Arguments

  1. [options] (Boolean|Object): See Rule.parser

Example

const {createConfig} = require('@webpack-blocks/webpack');
const {parser} = require('webpack-blocks-more');
 
module.exports = createConfig([
  parser({
    amd: false,
    browserify: false,
    requireJs: false,
    system: false,
    requireInclude: false,
    requireEnsure: false,
  }),
]);

image([options])

Arguments

  1. [options] (Object): image-webpack-loader options.

Example

const {createConfig, match} = require('@webpack-blocks/webpack');
const {file} = require('@webpack-blocks/assets');
const {image} = require('webpack-blocks-more');
 
module.exports = createConfig([
  match(['*.jpg', '*.png'], [
    file(),
    image(),
  ]),
]);

stylus([options])

Arguments

  1. [options] (Object): stylus-loader options.

Example

const {createConfig, match} = require('@webpack-blocks/webpack');
const {file, css} = require('@webpack-blocks/assets');
const {extract, stylus} = require('webpack-blocks-more');
 
module.exports = createConfig([
  // for development:
  match('*.styl', [
    css(),
    stylus(),
  ]),
 
  // for production:
  match('*.styl', [
    file({
      name: '[hash:20].css',
    }),
    extract(),
    css({
      styleLoader: false,
    }),
    stylus(),
  ]),
]);

extract([options])

Arguments

  1. [options] (Object): extract-loader options.

Example

const {createConfig, match} = require('@webpack-blocks/webpack');
const {file, css} = require('@webpack-blocks/assets');
const {extract} = require('webpack-blocks-more');
 
module.exports = createConfig([
  match('*.css', [
    file({
      name: '[hash:20].css',
    }),
    extract(),
    css({
      styleLoader: false,
    }),
  ]),
]);