Laravel-mix: combine javascript and run prod produce "undefined" file content

Created on 19 Oct 2020  路  10Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 5.0.7
  • Node Version (node -v): 12.18.3
  • NPM Version (npm -v): 6.14.6
  • OS: Windows 10

Description:

With using mix.combine() in a prod env, the output file contains "undefined". No errors are thrown. mix.babel() produce an output. No problem with both in development mode.

could be linked with the minimify library.

Steps To Reproduce:

  1. add files to mix.combine([])
  2. npm run prod
  3. get .js files with "undefined" in it

Most helpful comment

Me too...

mix.combine('resources/js/anim.js', folder.dist_assets + "js/anim.min.js");

In npm run dev -> anim.min.js 50kb all ok , but in npm run prod anim.min.js 10bytes and inside the file undefined.

My quick workaround is to not minify this file, only copy.

All 10 comments

image

even with babel this time...

Could you please provide a reproduction repo?

I鈥檒l try!

here a small sample: test_webpack.zip

npm run dev: both files are compiled ok
npm run prod:

  • compile: undefined
  • babel: ok

with our whole project, event babel produce a file with "undefined" in it

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

We build in development mode for release builds in the meantime...

Me too...

mix.combine('resources/js/anim.js', folder.dist_assets + "js/anim.min.js");

In npm run dev -> anim.min.js 50kb all ok , but in npm run prod anim.min.js 10bytes and inside the file undefined.

My quick workaround is to not minify this file, only copy.

+1
mix.scripts(['resources/js/composite.js'], 'public/js/composite.js') npm run dev and prod returns both undefined inside the generated file. It was OK earlier.. And once poof, and it`s gone..
node: v10.21.0,
npm: 5.8.0,
laravel-mix: 5.0.7

Our solution was to go with webpack directly, removing "laravel-mix".

+1

upgraded to latest version and broken my script!!

i cant compile and after that combine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nezaboravi picture nezaboravi  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

mstralka picture mstralka  路  3Comments

pixieaka picture pixieaka  路  3Comments

RomainGoncalves picture RomainGoncalves  路  3Comments