Skip to content

Commit 4ca06ac

Browse files
committed
fix: remove dynamic require for better vite support
1 parent 04eeae7 commit 4ca06ac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/plugin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import dayjs from 'dayjs'
22

33
<%= options.locales.map(l => `import 'dayjs/locale/${l}'`).join('\n') %>
4+
<%= options.plugins.map(l => `import ${l.replace(/[^A-Za-z]/g, '_')} from 'dayjs/plugin/${l}'`).join('\n') %>
45

5-
<%= options.plugins.map(l => `dayjs.extend(require('dayjs/plugin/${l}'))`).join('\n') %>
6+
<%= options.plugins.map(l => `dayjs.extend(${l.replace(/[^A-Za-z]/g, '_')})`).join('\n') %>
67

78
<% if (options.defaultLocale) { %>
89
dayjs.locale('<%= options.defaultLocale %>')

0 commit comments

Comments
 (0)