Topic: MDB Calender error after compliation

coregenion priority asked 6 months ago


Expected behavior

There should be no console errors after complitaion

Actual behavior

I get the error:

Uncaught TypeError: Cannot set properties of undefined (setting 'Calendar')
at all.min.js:1:16
at ./node_modules/mdb-ui-kit/plugins/js/all.min.js (all.min.js:1:208)
at __webpack_require__ (bootstrap:19:1)
at ./assets/js/mdb/plugins.js (mdb.js:2:17)
at __webpack_require__ (bootstrap:19:1)
at ./assets/js/admin/_adminMain.js (adminMain.js:61:74)
at __webpack_require__ (bootstrap:19:1)
at __webpack_exec__ (multi-select.css:1:1)
at multi-select.css:1:1
at __webpack_require__.O (chunk loaded:23:1)

Resources (screenshots, code snippets etc.)

assets/js/mdb/mdb.js:

import * as mdb from 'mdb-ui-kit/js/mdb.umd.min.js';
window.mdb = mdb;

assets/js/mdb/plugins.js:

import * as plugins from 'mdb-ui-kit/plugins/js/all.min.js'; // lib
window.plugins = plugins;

And in my assets/js/admin/_adminMain.js I have added it like this:

// MDB
import '../mdb/mdb.js';
import '../mdb/plugins.js';

When I do yarn encore dev Everthing is okay, and build is scucessful but I get that error in frontend. What I am doing wrong here? Thanks.

Edit

I am using webpack to compile my assets:

This is my webpack.config.js file:

    var Encore = require('@symfony/webpack-encore');

    if (!Encore.isRuntimeEnvironmentConfigured()) {
        Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
    }

    Encore
        // public path used by the web server to access the output path
        .setPublicPath('/build')
        // clean output path before each build
        .cleanupOutputBeforeBuild()
        // auto import jQuery & Provide variables
        .autoProvidejQuery()
        // enable sass/scss parser
        .enableSassLoader()
        // enable build notifications
        .enableBuildNotifications()
        // enable source maps during development
        .enableSourceMaps(!Encore.isProduction())
        // enable versioning
        .enableVersioning(Encore.isProduction())

        // add entry points for js & css files for templates/Admin/shopAdmin.html.twig
        .addEntry('js/adminMain', './assets/js/admin/_adminMain.js')
        .addStyleEntry('css/adminMain', './assets/scss/admin/_adminMain.scss')   

        // split entry chunks 
        .splitEntryChunks()
        // enable single runtime chunk
        .enableSingleRuntimeChunk()
        // enable babel
        .configureBabel(() => {}, {
            useBuiltIns: 'usage',
            corejs: 3
        })

    ;

    // export the final configuration
    module.exports = Encore.getWebpackConfig();

Grzegorz Bujański staff answered 6 months ago


Unfortunately, I am unable to reproduce this error. Can you prepare a minimal repository in which I will be able to reproduce this error? Don't add npm token in package.json file when publishing them


coregenion priority commented 6 months ago

Sorry, I forgot to mention another part. I made an edit. Thanks.

Also this is only in 7.1 version. Its working fine in 7.0


Grzegorz Bujański staff commented 6 months ago

I still can't reproduce it. Without a repository on which we will be able to test it, we will not be able to check what is happening.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.1.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: Yes
  • Provided link: No