# dayjs-webpack-plugin

> Day.js webpack plugin

Latest version **0.0.2** (published 2019-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install dayjs-webpack-plugin
pnpm add dayjs-webpack-plugin
yarn add dayjs-webpack-plugin
bun add dayjs-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-11-27 |
| First published | 2019-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | iamkun |
| Maintainers | iamkun |
| Keywords | Day.js, Webpack, Moment |

## Links

- npm: https://www.npmjs.com/package/dayjs-webpack-plugin
- npm.io page: https://npm.io/package/dayjs-webpack-plugin

## Dependencies (1)

- [dayjs](https://npm.io/package/dayjs.md) *

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-11-27
- 0.0.1 — 2019-11-26

## README

# dayjs-webpack-plugin

[![NPM version](http://img.shields.io/npm/v/dayjs-webpack-plugin.svg?style=flat-square)](https://www.npmjs.org/package/dayjs-webpack-plugin)

A webpack plugin for [dayjs](https://github.com/iamkun/dayjs). 

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

## Usage

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


## Example

```js
import DayjsWebpackPlugin from 'dayjs-webpack-plugin';

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

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

### Configuration

| Attribute      | Description          | Type      | Accepted Values       | Default  |
| ----------------- | -------------------------------- | --------------- | ------ | ------ |
| plugins           | plugin name    | Array[string]          |   all support plugins    |    []    |
| locales              | locale name                | Array[string] | all support locales | []  |
| replaceMoment              | replace moment to dayjs with webpack alias config  | Boolean | true / false | false  |
| preset              | name of preset configuration                   | String | antd | -  |

---
_Source: https://npm.io/package/dayjs-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
