@electerm/antd-dayjs-webpack-plugin
Version:
Day.js webpack plugin for Ant Design (antd)
19 lines (13 loc) • 489 B
JavaScript
const { getOptions } = require('loader-utils')
module.exports = function loader(source) {
const options = this.getOptions()
options.plugins.forEach((plugin) => {
source += `var ${plugin} = require('dayjs/plugin/${plugin}');`
})
options.plugins.forEach((plugin) => {
source += `dayjs.extend(${plugin});`
})
// special plugin
source += `var antdPlugin = require('@electerm/antd-dayjs-webpack-plugin/src/antd-plugin');dayjs.extend(antdPlugin);`
return source
}