0.0.2 • Published 4 years ago

dayjs-webpack-plugin v0.0.2

Weekly downloads
89
License
MIT
Repository
-
Last release
4 years ago

dayjs-webpack-plugin

NPM version

A webpack plugin for dayjs.

  • Pre-pack all the needed plugins and locales.
  • Auto replace moment with dayjs in source code.

Usage

  1. Install dayjs-webpack-plugin.
  2. Add an instance of the plugin to the webpack plugin configuration.

Example

import DayjsWebpackPlugin from 'dayjs-webpack-plugin';

const configuration = {
  plugins: ['utc'],
  locales: ['zh-cn'],
  replaceMoment: true
};

module.exports = {
  // ...
  plugins: [
    new DayjsWebpackPlugin(configuration)
  ]
};

Configuration

AttributeDescriptionTypeAccepted ValuesDefault
pluginsplugin nameArraystringall support plugins[]
localeslocale nameArraystringall support locales[]
replaceMomentreplace moment to dayjs with webpack alias configBooleantrue / falsefalse
presetname of preset configurationStringantd-