Topic: MDB no longer working as node package
Arnt Oddvar Pedersen pro asked 5 years ago
Hello! I recently decided to upgrade MDB Pro on one of my projects and quickly noticed that it's not loading at all with the latest changes.
Luckily I can always roll back to a different version. See the attached error message:
It's a chain of errors that start at line 8630 in your compiled mdb.js file. Commenting out the wrong export and the error message jumps to the Chart.js export, and so on, and so on.
MDB is imported through a vendors.js file, as you can see here:
Are you properly execution the module loader? They should be loaded as follows internally; (This is how we do it at my current work location)
-- With dependency
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('jquery'));
} else {
root.YourModule = factory(root.jQuery);
}
}(this, function (jquery) {
return {};
}));
-- No dependencies
;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.YourModule = factory();
}
}(this, function () {
return {};
}));
-- Support for circular references:
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'jquery'], factory);
} else if (typeof exports === 'object') {
factory(exports, require('jquery'));
} else {
factory((root.YourModule = {}), root.jQuery);
}
}(this, function (exports, jQuery) {
exports.action = function () {};
}));
Arnt Oddvar Pedersen pro answered 5 years ago
I've set-up 2 NPM projects for you guys over at MDB to check out; one using MDB 4.8.11 without issues, and the other using MDB 4.10.0 (with updated paths) and exports import error.
Both projects are using the latest version of Webpack 4 + cli, Babel (core, cli, runtime, transforms, proposal)
I've not got permission from my manager to post these publicly, so send me an email; arnt.o.pedersen@gmail.com and I'll send you the projects.
Bartłomiej Malanowski staff pro premium commented 5 years ago
Could you please share your mentioned projects with me at b.malanowski@mdbootstrap.com?
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.10.0
- Device: PC, Android, iOS
- Browser: Firefox, Chrome, Edge, Safari
- OS: Windows 10, Android Q, OSX 10.15
- Provided sample code: No
- Provided link: No