Import sortablejs
only once (#25936)
Previously, `sortablejs` was imported twice, once synchronously and once asynchronously, leading to webpack creating duplicate output code (once in the index bundle, and once in a separate chunk). Fix this by always asynchronously importing it. This was one of the build warnings observed when trying to build with vite.
This commit is contained in:
parent
d0a9456c4f
commit
8bb0a03eaa
3 changed files with 10 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import {useLightTextOnBackground} from '../utils/color.js';
|
||||
import tinycolor from 'tinycolor2';
|
||||
import {createSortable} from '../modules/sortable.js';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
|
@ -55,12 +56,10 @@ async function initRepoProjectSortable() {
|
|||
const els = document.querySelectorAll('#project-board > .board.sortable');
|
||||
if (!els.length) return;
|
||||
|
||||
const {Sortable} = await import(/* webpackChunkName: "sortable" */'sortablejs');
|
||||
|
||||
// the HTML layout is: #project-board > .board > .board-column .board.cards > .board-card.card .content
|
||||
const mainBoard = els[0];
|
||||
let boardColumns = mainBoard.getElementsByClassName('board-column');
|
||||
new Sortable(mainBoard, {
|
||||
createSortable(mainBoard, {
|
||||
group: 'board-column',
|
||||
draggable: '.board-column',
|
||||
filter: '[data-id="0"]',
|
||||
|
@ -89,7 +88,7 @@ async function initRepoProjectSortable() {
|
|||
|
||||
for (const boardColumn of boardColumns) {
|
||||
const boardCardList = boardColumn.getElementsByClassName('board')[0];
|
||||
new Sortable(boardCardList, {
|
||||
createSortable(boardCardList, {
|
||||
group: 'shared',
|
||||
animation: 150,
|
||||
ghostClass: 'card-ghost',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue