webpack-blocks-more
v0.0.10
Published
Just a few blocks that 📦webpack-blocks is missing
Downloads
9
Maintainers
Readme
webpack-blocks-more ·
Just a few blocks that 📦webpack-blocks is missing.
Designed to be used with webpack@3+
and webpack-blocks@1+
.
Table of Content
API
watch([options])
Watch mode.
Arguments
[options]
(Object): SeewatchOptions
for available properties.
parser([options])
Parser options.
Arguments
[options]
(Boolean|Object): SeeRule.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,
}),
]);
babel([options])
Arguments
[options]
(Object):babel-loader
options.
Example
const {createConfig, match} = require('@webpack-blocks/webpack');
const {thread, babel} = require('webpack-blocks-more');
module.exports = createConfig([
match(['*.js', '*.mjs'], {exclude: 'node_modules'} [
thread(),
babel(),
]),
]);
image([options])
Arguments
[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(),
]),
]);
postcss([options])
Arguments
[options]
(Object):postcss-loader
options.
Example
const {createConfig, match} = require('@webpack-blocks/webpack');
const {file, css} = require('@webpack-blocks/assets');
const {extract, postcss} = require('webpack-blocks-more');
module.exports = createConfig([
// for development:
match('*.styl', [
css(),
postcss({
plugins: {
autoprefixer: {}
}
}),
]),
// for production:
match('*.styl', [
file({
name: '[hash:20].css',
}),
extract(),
css({
styleLoader: false,
}),
postcss({
plugins: {
autoprefixer: {}
}
}),
]),
]);
stylus([options])
Arguments
[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
[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,
}),
]),
]);
thread([options])
Arguments
[options]
(Object):- all
thread-loader
options. warmupModules
(Array): an array of modules to prewarm.
- all
Example
const {createConfig, match} = require('@webpack-blocks/webpack');
const babel = require('@webpack-blocks/babel');
const {thread} = require('webpack-blocks-more');
module.exports = createConfig([
match('*.js', [
thread({
warmupModules: ['babel-loader', '@babel/core', '@babel/preset-env'],
}),
babel({
cacheDirectory: true,
}),
]),
]);