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.

[0.12.0] .scripts([input], output) in production environment outputs 'undefined'

See original GitHub issue
  • Laravel Mix Version: 0.12.0
  • Node Version: 7.5.0
  • NPM Version: 4.1.2
  • OS: OS X El Capitan 10.11.6

Description:

Attempting to minify vanilla JS, without webpack. Running in dev environment works as expected, but production environment outputs ‘undefined’ for all javascript output files.

Steps To Reproduce:

Using the following files:

package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.15.3",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^3.2.3",
    "jquery": "^2.2.3",
    "laravel-mix": "0.*",
    "lodash": "^4.17.4",
    "vue": "^1.0.26"
  }
}

webpack.mix.js


mix.options({
    processCssUrls: false,
});
mix.sass('resources/assets/sass/app.scss', 'public/css');
mix.scripts(['resources/assets/js/app.js'], 'public/js/app.js');
mix.scripts(['resources/assets/js/enquiry.js'], 'public/js/enquiry.js');
mix.scripts(['resources/assets/js/login.js'], 'public/js/login.js');
mix.scripts(['resources/assets/js/register.js'], 'public/js/register.js');
mix.scripts(['resources/assets/js/search.js'], 'public/js/search.js');
mix.scripts([
   'node_modules/jquery/dist/jquery.js',
   'node_modules/bootstrap-sass/assets/javascripts/bootstrap/collapse.js',
   'node_modules/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js',
   'node_modules/bootstrap-sass/assets/javascripts/bootstrap/tab.js',
   'node_modules/bootstrap-sass/assets/javascripts/bootstrap/transition.js',
], 'public/js/vendor.js');
mix.copyDirectory('resources/assets/fonts', 'public/fonts');
mix.copyDirectory('resources/assets/img', 'public/img');

npm run dev: Outputs all files as expected. Sass, vanilla js (concatenated, unminified), etc. npm run prod: All js output files contain ‘undefined’.

I’ve downgraded to Laravel Mix 0.11.4, which has fixed my issues.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ankurk91commented, May 29, 2017

Should be fixed by v0.12.1

0reactions
dhawtoncommented, May 28, 2017

I found the issue while using .babel, same solution resolved the issue.

Verified setting laravel-mix to 0.11.4 in package.json has it properly uglifying/outputting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[0.12.0] .scripts([input], output) in production environment ...
Attempting to minify vanilla JS, without webpack. Running in dev environment works as expected, but production environment outputs 'undefined' ...
Read more >
Automated Test Framework - How to solve "undefined...
Automated Test Framework - How to solve "undefined" as output of a ATF test step (Run server side script). Go to solution. lucascd....
Read more >
Input Output Reference - EnergyPlus
1.1 What's different about EnergyPlus Input and Output? ... 1.7.30 Climate Group Outputs . ... C programs and Python scripts.
Read more >
Why does declaring a variable in console produce undefined ...
The output you're seeing in the console is simply the printed value that your code resolved to. The statement doesn't resolve to a...
Read more >
Interface Specifications - Nipype - Read the Docs
The OutputSpec defines the outputs that are generated, or possibly generated depending on inputs, by the tool. OutputSpecs inherit from interfaces.base.
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