无法在 laravel 组合中添加 bootstrap.min.js
Can't add bootstrap.min.js within laravel mix
我正在尝试通过 Laravel mix
合并我所有的资产文件。
当我尝试在混合中添加 bootstrap js 时遇到问题,它说 can't resolve propper.js
,但我已经在它之前添加了,
这是我的混音配置代码。
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.
我做的有点不一样。
我使用 yarn(或者你可以使用 npm)下载了 bootstrap。因此,您将拥有一个文件夹 node_modules/bootstrap
在webpack.mix.js我只有app.js
.
在 app.js 我有
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');
注意! popper.js 和 jQuery 我也是通过 yarn(或 npm)下载的
我正在尝试通过 Laravel mix
合并我所有的资产文件。
当我尝试在混合中添加 bootstrap js 时遇到问题,它说 can't resolve propper.js
,但我已经在它之前添加了,
这是我的混音配置代码。
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.
我做的有点不一样。
我使用 yarn(或者你可以使用 npm)下载了 bootstrap。因此,您将拥有一个文件夹 node_modules/bootstrap
在webpack.mix.js我只有app.js
.
在 app.js 我有
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');
注意! popper.js 和 jQuery 我也是通过 yarn(或 npm)下载的