mdcuesta
mdcuesta

Reputation: 1739

Bootstrap 4 requiring individual jQuery Plugins - Uncaught ReferenceError: Util is not defined

Bootstrap 4 alpha. Created a modal by referencing individual files, in this case "util.js" and "modal.js". In opening the modal it throws this exception.

Uncaught ReferenceError: Util is not defined

See fidle: https://fiddle.jshell.net/bhjk6tg4/

Updated the fiddle, I got it working, it turns out you need to import the "util.js" first.

Note: I can't find a CDN for bootstrap 4 alpha individual files, so I copied the raw javascript file of modal.js and paste it in the fiddle (javascript).

Upvotes: 4

Views: 3603

Answers (1)

Farside
Farside

Reputation: 10333

This issue is happening because , doesn't respect UMD after the version v4.0.0-alpha.3. Please, see the explanation and the corresponding pull request:

This removes UMD and CommonJS transpilation from the build.

Therefore an old module formats & loaders/transpilers (AMD+requirejs, CommonJS+browserify, etc), can't be used the old way, as individual UMD files are not available in the directory anymore.

You would need to update the way you build your JS application, or to use the compiled Bootstrap JS from /dist.

Upvotes: 2

Related Questions