Page 1 of 1

[ASP.NET MVC] - Bryntum bundle included twice

Posted: Mon Sep 19, 2022 7:51 am
by rodel.ocfemia

Hi,

We encountered the following error when we navigate back to the MVC page with bryntum taskboard implementation. When we first access the page, the error did not show up.

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.
at j.setVersion (<anonymous>:12:527616)
at ./lib/Core/Base.js (<anonymous>:12:37825)
at c (<anonymous>:11:153)
at ./webpack/webpack.core.entry.thin.js (<anonymous>:20:1111851)
at c (<anonymous>:11:153)
at ./webpack/webpack.entry.js (<anonymous>:20:1187115)
at c (<anonymous>:11:153)
at ./webpack/webpack.entry.umd.js (<anonymous>:20:1235169)
at c (<anonymous>:11:153)
at ../node_modules/process/browser.js (<anonymous>:11:1705)

Basically below are the code of the .cshtml file.

<script src="~/Scripts/Bryntum/taskboard.umd.js"></script>

<div id="kanbanContainerBryntum"></div>

<script>
var taskboard = new bryntum.taskboard.TaskBoard({
	...
})
</script>

Is there a way to prevent the error from displaying?

Thanks


Re: [ASP.NET MVC] - Bryntum bundle included twice

Posted: Mon Sep 19, 2022 9:47 am
by alex.l

Hi rodel.ocfemia,

This error appears when code imported twice from 2 different sources. As examples, from umd and module version, as mentioned in error description, or if you also imported from sources.

This also may happens if taskboard.umd.js loaded every time when you switch page back to taskboard, with different timestamps or like that.
Check Network tab and see if sources loaded 2nd time during life cycle, find why and fix that.


Re: [ASP.NET MVC] - Bryntum bundle included twice

Posted: Mon Sep 19, 2022 10:16 am
by rodel.ocfemia

Hi Alex,

I have to put the taskboard.umd.js include code in the Master Layout page to fix the issue.
It's ok now.

Thanks


Re: [ASP.NET MVC] - Bryntum bundle included twice

Posted: Mon Oct 31, 2022 6:52 pm
by sdunn

I just ran into this issue using Vite (as opposed to WebPack). It was solved by turning on dependency optimization in the vite.config.js

// vite.config.js
...
optimizeDeps: {
        // Bryntum components need to resolve either the CommonJS or UMD module types; will throw an error
        // without this
        include: ['@bryntum/gantt', '@bryntum/gantt-vue'],
...

Re: [ASP.NET MVC] - Bryntum bundle included twice

Posted: Mon Oct 31, 2022 7:03 pm
by alex.l

Thank you a lot for letting us know!