Giter Club home page Giter Club logo

webpack-messages's Introduction

webpack-messages

Beautifully format Webpack messages throughout your bundle lifecycle(s)!

Default

Default Error

Named Bundles

Named Bundle Error

Custom Logger

Named Bundle Error w/ Custom Logger

Install

$ npm install webpack-messages --save-dev

Usage

// webpack.config.js
const WebpackMessages = require('webpack-messages');

module.exports = {
  // ...
  plugins: [
    new WebpackMessages({
      name: 'client',
      logger: str => console.log(`>> ${str}`)
    })
  ]
}

API

WebpackMessages(options)

options.name

Type: String

Optionally provide a name for your bundle. Strongly recommended when compiling multiple bundles!

options.logger

Type: Function
Default: str => console.log(str)

Replace the default function -- ideal for prepending a symbol or namespace to your messages.

Function receives a (colorized) message string as its only parameter.

options.onComplete

Type: Function

Run a custom function once a bundle has been compiled successfully. If provided, the default success handler will not run.

Function receives a formatted name string (or '') and the Webpack stats object.

License

MIT © Luke Edwards

webpack-messages's People

Contributors

lukeed avatar mattvagni avatar mkleywegt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

webpack-messages's Issues

[Question] Does this work with webpack-dev-server?

Hi! Does this package work with webpack-dev-server? And if so, is there any kind of special configuration which I would need to make it work?

It doesn't seem to be working for me. Here's an overview of the relevant parts of my webpack.config.js:

const WebpackMessages = require('webpack-messages');

const config = {
  mode: 'development',
  devServer: {
    hot: true,
    port: 3001,
    historyApiFallback: true,
    host: '0.0.0.0',
    disableHostCheck: true,
    contentBase: path.resolve(__dirname, '../dist')
  },
  plugins: [
    new WebpackMessages({
      name: 'myapp'
    }),
  ]
};

Seems like it should be working, but I just get the usual (ugly) webpack output.

Adding types for `webpack-messages`

Thanks for this library, @lukeed.

When looking at converting Webpack configurations to Typescript, I discovered that they were no type declarations for this package. I’ve taken the time to create a declaration for our internal use, but would love to share these with others. Several ways forward are possible, and I would love to have your thoughts on which works best for you:

  1. use JSDoc type declarations into this package. I’ve already created a fork with them
  2. only bring the type declaration as a one-off into this package. I’ve already created a fork with it.
  3. convert this project to typescript. I’ve created a fork for that, too, but you may have no interest to maintain a TS codebase
  4. you don’t want to hear about Typescript, and I’ll raise a DefinitelyTyped package on my own. I’m happy with that option too!

Disable auto-reloading of the terminal

Hello, this package is really useful for me but I've found that the terminal (ZSH) does a clear screen when webpack compiles and outputs the messages.

Is there a setting that doesn't clear the terminal output so that the log messages just get appended to the terminal?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.