webpack-blocks
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/webpack-blocks package

2.1.0 • Public • Published

webpack-blocks - the convenience package

Gitter chat NPM Version

This is the webpack-blocks convenience package. It wraps all the most commonly used blocks, so you can install just this single package and have webpack-blocks and your favorite blocks set up.

Usage

Here is a small sample configuration. Instead of requiring from @webpack-blocks/webpack, @webpack-blocks/babel and others you just need a single require() and a single dependency in your package.json.

Of course you can still separately define or install custom blocks and use them as you want.

const webpack = require('webpack')
const {
  babel,
  createConfig,
  css,
  defineConstants,
  entryPoint,
  env,
  extractText,
  match,
  setOutput,
  uglify,
  postcss 
= require('webpack-blocks')
const cssnano = require('cssnano')
 
module.exports = createConfig([
  entryPoint('./src/main.js'),
  setOutput('./build/bundle.js'),
  babel(),
  defineConstants({
    'process.env.NODE_ENV': process.env.NODE_ENV
  }),
  match('*.css', { exclude: /node_modules/ }, [
    css(),
    env('production', [
      extractText(),
      postcss({
        plugins: [cssnano()]
      })
    ])
  ]),
  env('production', [uglify()])
])

Included blocks

webpack-blocks

Check out the

👉 Main documentation

Released under the terms of the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i webpack-blocks

Weekly Downloads

499

Version

2.1.0

License

MIT

Unpacked Size

5.48 kB

Total Files

5

Last publish

Collaborators

  • andywer
  • webpack-blocks-andy