question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

laravel-mix injects unknown Javascript into my compiled JS

See original GitHub issue
  • Laravel Mix Version: 0.8.1
  • Node Version (node -v): 7.5.0
  • NPM Version (npm -v): 4.1.0
  • OS: Windows 10

Description:

Whenever 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) { ...}

Steps To Reproduce:

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
doncadavonacommented, Jan 14, 2018

Use mix.script()

3reactions
JeffreyWaycommented, Feb 21, 2017

It looks like you mostly want to concatenate files? If so, use mix.combine() instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

laravel-mix injects unknown Javascript into my compiled JS
Whenever I compile my JS with laravel-mix, the combined file app.js contains some webpack-JavaScript, that stops my JS from working in the ......
Read more >
Compiling Assets (Mix) - The PHP Framework For Web Artisans
Laravel Mix provides a fluent API for defining Webpack build steps for your Laravel application using several common CSS and JavaScript pre-processors.
Read more >
JavaScript | Laravel Mix Documentation
Run npm run dev to compile it all down. At this point, simply create an HTML file, import your ./js/app.js bundle, and load...
Read more >
combining js files in app.js in laravel 5 - Stack Overflow
First make sure you have latest nodejs installed and then run npm install after installation is done. On your webpack.mix.js add another ...
Read more >
Webpack and bundlers · Bootstrap v5.0
Installing Bootstrap. Install bootstrap as a Node.js module using npm. Importing JavaScript. Import Bootstrap's JavaScript by adding this line to your app's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found