Vite build leads to SyntaxError: Can't create duplicate variable: 'ma'

Vite build leads to SyntaxError: Can't create duplicate variable: 'ma'

SvenK69SvenK69 Posts: 3Questions: 1Answers: 0

Hi folks,

I use DataTables v2.2.2 with Vite v5.4.14. In Development mode with the vite server everything works fine, without any errors.
But after "vite build" I always get this error in the console log:
SyntaxError: Can't create duplicate variable: 'ma'

Here is my main.js:

import JSZip from 'jszip'
import pdfMake from 'pdfmake/build/pdfmake'
import pdfFonts from 'pdfmake/build/vfs_fonts'
pdfMake.vfs = pdfFonts.pdfMake ? pdfFonts.pdfMake.vfs : pdfFonts
import * as luxon from 'luxon'
import DataTable from 'datatables.net-bs5'
import 'datatables.net-buttons-bs5'
import 'datatables.net-buttons/js/buttons.html5.mjs'
import 'datatables.net-buttons/js/buttons.print.mjs'
import 'datatables.net-responsive-bs5'
import 'datatables.net-searchpanes-bs5'
import 'datatables.net-select-bs5'
import languageDE from 'datatables.net-plugins/i18n/de-DE.mjs'

DataTable.use(luxon)

let tableOrganizationList = new DataTable('#organizationList', {
  select: true,
  searchPanes: true,
  responsive: true,
  language: languageDE,
  layout: {
    topStart: {
      buttons: [
        {
          extend: 'pdfHtml5',
          download: 'open',
          orientation: 'landscape',
          pageSize: 'A4',
          title: 'Organisationen Liste',
          exportOptions: {
            columns: [0, 1, 2, 3],
          },
          customize: function (doc) {
            doc.defaultStyle.fontSize = 10
            doc.styles.tableHeader.fontSize = 11
            doc.styles.tableHeader.bold = true
          },
        },
        'copyHtml5',
        'csvHtml5',
        'print',
      ],
    },
    bottom: {
      searchPanes: {
        initCollapsed: true,
      },
    },
  },
  columnDefs: [
    {
      searchPanes: {
        show: false,
      },
      targets: [0],
    },
    {
      searchPanes: {
        show: true,
      },
      targets: [1],
    },
    {
      searchPanes: {
        show: true,
      },
      targets: [2],
    },
    {
      searchPanes: {
        show: true,
      },
      targets: [3],
    },
    {
      orderable: false,
      searchPanes: {
        show: false,
      },
      targets: [4],
    },
  ],
})

Any ideas, how to solve this problem?

Thanks in advance!

CU... Sven

Replies

  • allanallan Posts: 64,230Questions: 1Answers: 10,599 Site admin

    Can you create a test case on Stackblitz or a simple git repo showing the issue please?

    Allan

Sign In or Register to comment.