node -v): 7.5.0npm -v): 4.1.0Whenever I compile my JS with laravel-mix, the combined file app.js contains some webpack-JavaScript, that stops my JS from working in the browser. The code looks somewhat like this:
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
etc...
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(0)))
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function($, jQuery) { ...}
webpack.mix.js:
mix.js([
'resources/assets/js/jquery.ajaxsetup.js',
'resources/assets/js/jquery.document.ready.js',
'resources/assets/js/jquery.helpers.js',
'resources/assets/js/jquery.glossarium.vocab.js',
'resources/assets/js/jquery.glossarium.lektionen.js',
'resources/assets/js/jquery.glossarium.sachfelder.js',
'resources/assets/js/jquery.notifications.js',
'resources/assets/js/jquery.modal.js'], 'public/js/app.js')
npm run dev
It looks like you mostly want to concatenate files? If so, use mix.combine() instead.
Thanks, you helped me a lot
But this doesn't compile ECMA-script.
So what you could do is.
mix.sass('resources/assets/sass/app.scss', '../resources/assets/css')
.js([
'resources/assets/js/main.js',
'resources/assets/js/compiled/angular.js'],
'public/js/all.js')
.sass('resources/assets/materialize-src/sass/materialize.scss', '../resources/assets/css')
.extract(['jquery']);
=> Extract the module.
check your package.json to see which modules are compiled.
for more info:
https://laravel.com/docs/5.4/mix#vendor-extraction
How to disable this ? I don't want concatenate files...
Use mix.script()
Most helpful comment
It looks like you mostly want to concatenate files? If so, use
mix.combine()instead.