optimize webpack bundles

This commit is contained in:
Alex Turchyn
2023-06-24 18:31:12 +03:00
parent 2c0bed9823
commit 8bb6ff7ab3
10 changed files with 91 additions and 18 deletions
+4 -2
View File
@@ -1,5 +1,3 @@
import { DirectUpload } from '@rails/activestorage'
import { actionable } from '@github/catalyst/lib/actionable'
import { target, targetable } from '@github/catalyst/lib/targetable'
@@ -11,6 +9,8 @@ export default actionable(targetable(class extends HTMLElement {
]
connectedCallback () {
import('@rails/activestorage')
this.addEventListener('drop', this.onDrop)
this.addEventListener('dragover', (e) => e.preventDefault())
@@ -39,6 +39,8 @@ export default actionable(targetable(class extends HTMLElement {
async uploadFiles (files) {
this.toggleLoading()
const { DirectUpload } = await import('@rails/activestorage')
await Promise.all(
Array.from(files).map(async (file) => {
const upload = new DirectUpload(