[REACT] Uncaught Error: Bryntum bundle included twice..
Posted: Fri Mar 11, 2022 6:23 pm
by davide89
Hi, I was using your version of gantt 4.2.2 and gantt-react 4.2.2 and I had no problem with importing the two modules at the same time. Going to version 5.0.1, but also from some previous version, I get this error:
Uncaught Error: Bryntum bundle included twice, check cache-busters and file types (.js).
Simultaneous imports from ".module.js" and ".umd.js" bundles are not allowed.
I need to import LocaleManager to handle the language change in the gantt.
import React, { forwardRef, useEffect } from 'react'
import { BryntumGantt } from '@bryntum/gantt-react'
import { LocaleManager } from '@bryntum/gantt/gantt.umd'
import { getTaskTooltipFeature } from './helpers'
import Ru from '@bryntum/gantt/locales/gantt.locale.Ru'
import En from '@bryntum/gantt/locales/gantt.locale.En'
import It from './locales/gantt.locale.IT'
import zipcelx from 'zipcelx'
import './index.scss'
const locales = {
'it-IT': It,
'ru-RU': Ru,
'en-GB': En
}
const DEFAULT_LOCALE = 'it-IT'
const Gantt = forwardRef(
(
{
taskTooltipRenderer,
onTaskBarClick,
data,
syncDataOnLoad,
locale,
onCellClick,
taskStore,
...props
},
ref
) => {
useEffect(() => {
LocaleManager.locale = locales[locale || DEFAULT_LOCALE]
}, [locale])
return (
<div className='gantt-wrapper-container'>
<BryntumGantt
ref={ref}
{...props}
pdfExportFeature
taskTooltipFeature={getTaskTooltipFeature(taskTooltipRenderer)}
onTaskClick={onTaskBarClick}
excelExporterFeature={{ zipcelx }}
onCellClick={onCellClick}
/>
</div>
)
}
)
export default Gantt
Is there a solution to this bug?What I have found so far has not helped me.
Thanks
Re: [REACT] Uncaught Error: Bryntum bundle included twice..
Posted: Mon Mar 14, 2022 5:21 am
by alex.l
Hi davide89,
The error appears because you imported from 2 bundles, as it described in error message.
Just update the package name you imported LocaleManager from
import { LocaleManager } from '@bryntum/gantt';
Re: [REACT] Uncaught Error: Bryntum bundle included twice..
Posted: Mon Mar 14, 2022 6:48 pm
by davide.cardia
Yes, I tried and it doesn't give me any errors at the start and the language is set correctly. But when I try to change it from the interface, this error comes up:
Re: [REACT] Uncaught Error: Bryntum bundle included twice..
Posted: Mon Mar 21, 2022 7:21 am
by alex.l
Please attach a runnable test case. Unfortunately we don't have an example with Routing for React that I can use to test your scenario.
Re: [REACT] Uncaught Error: Bryntum bundle included twice..
Posted: Fri Apr 01, 2022 9:51 am
by davide.cardia
It seems that you don't even need to change the language, you just need to change route and return to the gantt page. The localeManager gives problems if the columnsDefs of the grid are also present.
Re: [REACT] Uncaught Error: Bryntum bundle included twice..
Posted: Tue Apr 05, 2022 9:01 am
by alex.l
Confirmed. There are some problems with change localization at runtime.
Looks like something related to React, especially with routing, since it works good in vanilla version, and it React without routing.
I've opened a ticket to check and fix that: https://github.com/bryntum/support/issues/4457
Thank you for the test case and the report!
Re: [REACT] Uncaught Error: Bryntum bundle included twice..