admin管理员组

文章数量:1292753

I'm trying to bine all of my assets files via Laravel mix.

I fall in problem when I tried to add bootstrap js in the mix, it said can't resolve propper.js, but I already add that before it,

Here is my mix configuration code.

var mix = require('laravel-mix');

mix
    .js([
        'resources/assets/js/jquery.min.js',
        'resources/assets/js/popper.min.js',
        'resources/assets/js/bootstrap.min.js',
        'resources/assets/js/app.js'
    ], 'public/js/app.js')
   .sass('resources/assets/sass/app.scss', 'public/css');

I think I'm doing something in a wrong way, plz make me correct.

I'm trying to bine all of my assets files via Laravel mix.

I fall in problem when I tried to add bootstrap js in the mix, it said can't resolve propper.js, but I already add that before it,

Here is my mix configuration code.

var mix = require('laravel-mix');

mix
    .js([
        'resources/assets/js/jquery.min.js',
        'resources/assets/js/popper.min.js',
        'resources/assets/js/bootstrap.min.js',
        'resources/assets/js/app.js'
    ], 'public/js/app.js')
   .sass('resources/assets/sass/app.scss', 'public/css');

I think I'm doing something in a wrong way, plz make me correct.

Share Improve this question edited Aug 22, 2018 at 17:12 Bharata 14.2k6 gold badges43 silver badges53 bronze badges asked Jan 15, 2018 at 7:34 King RayhanKing Rayhan 2,4794 gold badges20 silver badges24 bronze badges 2
  • you need to add popper.js i guess you are using bs4?? – Mr. Pyramid Commented Jan 15, 2018 at 7:38
  • 1 @Mr.Pyramid Yes, I'm using bootstrap 4. I already add propper.min.js before bootstrap.min.js image.prntscr./image/8Nm0NgDUSVGFBhoHeuZLVg.png – King Rayhan Commented Jan 15, 2018 at 7:44
Add a ment  | 

1 Answer 1

Reset to default 9

I made it differently a bit. I downloaded bootstrap using yarn (or you can use npm). As a result you will have a folder node_modules/bootstrap

In the webpack.mix.js I have only app.js.

In the app.js I have

window.Popper = require('popper.js');

/**
 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.
 */

window.$ = window.jQuery = require('jquery');

require('bootstrap');

Note! popper.js and jQuery I also downloaded via yarn (or npm)

本文标签: javascriptCan39t add bootstrapminjs within laravel mixStack Overflow