@andyyou/log-loader

0.1.5 • Public • Published

log-loader

Loader for webpack to dev and console.log compile result during development.

Usage

Add loader to module.rules

const path = require('path');

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
          },
          {
            loader: 'log-loader',
            options: {
              beforeMessage: 'After resolve-url-loader',
            }
          },
          {
            loader: 'resolve-url-loader',
          },
          {
            loader: 'sass-loader',
            options: {
              sourceMap: true,
            }
          }
        ],
      },
    ]
  }
}

Options

|option|description|type|default| |---|---|---|---|---| |beforeMessage|show message before console result|string|''| |afterMessage|show message after console result|string|''|

Testing script

// test.js
const webpack = require('webpack');
const config = require('./webpack.config');

const compiler = webpack(config);
compiler.run((err, stats) => {
  console.log('Compiled');
});
$ node test.js

Package Sidebar

Install

npm i @andyyou/log-loader

Weekly Downloads

4

Version

0.1.5

License

MIT

Unpacked Size

2.21 kB

Total Files

3

Last publish

Collaborators

  • andyyou