Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

871
Views
Laravel Ui bootstrap, bootstrap is not defined

I've created a new laravel project laravel new project

And installed bootstrap ui like so:

php artisan ui bootstrap

Then compiled with :

npm install
npm run dev

But when I use bootstrap inside app.js like so :

require('./bootstrap');

var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
    return new bootstrap.Tooltip(tooltipTriggerEl)
});

The console shows the following error :

app.js?e348:5 Uncaught ReferenceError: bootstrap is not defined
    at eval (app.js?e348:5:5)
    at Array.map (<anonymous>)
    at eval (app.js?e348:4:38)
    at Object../resources/assets/js/app.js (app.js:973:1)
    at __webpack_require__ (app.js:1060:42)
    at app.js:1214:86
    at Function.__webpack_require__.O (app.js:1097:23)
    at app.js:1217:53
    at app.js:1219:12

I've to mention that I run npm run dev after making changes in any resource file, and I know about npm run watch.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Ok, I solved the problem this way:

in resources/js/bootstrap.js file :

window._ = require('lodash');

try {
    window.$ = require('jquery');
    window.bootstrap = require('bootstrap');
} catch (e) {
    console.error(e);
}

notice the line : window.bootstrap = require('bootstrap');

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!