Define the order of require in Laravel-mix/Webpack

Viewed 1050

I'm having trouble with adding Summernote to my NPM. I want to use NPM so that all of the JS and CSS files are in one file. Unfortunately, I have not been able to get Summernote to work when I add it in the Laravel-mix and Webpack. I know it works when I add the script link in my main.blade.php. The problem is that jQuery is always at the end of my app.js file, but I need Summernote to be the last.

webpack.mix.js

mix.js([
    'resources/assets/js/app.js',
    // I tried to add a new file with only summernote required to get it to be the
    // last package to be in the app.js but no luck. 
    //'resources/assets/js/summernote.js'
], 'public/js'); 

assets/js/app.js

require('./bootstrap');

// Menu
require('./sidebar.js');

./bootstrap

window._ = require('lodash');

/**
 * 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');

// Packages
require('bootstrap-sass');
require('owl.carousel');
require('perfect-scrollbar/jquery')(window.$);
require('datatables.net-bs');
require('codemirror');
require('summernote'); 

require('select2');
// Set some global options for select2
$.fn.select2.defaults.set("theme", "bootstrap");

I know that all the version of jQuery, bootstrap etc are working together so that is not the problem. I just need to get the summernote js code underneath the jquery...

0 Answers
Related