Search code examples
javascriptphplaravellaravel-5laravel-elixir

Use strict added to every file after Laravel Elixir upgrade - broken scripts


I upgraded my Elixir and Gulp and right now I can see that some of my mixed scripts are broken.

When I hit gulp or gulp --production everything seems to be compiled, mixed and versioned fine. Problem is directly on the page. Scripts throw exceptions in the console.

Two broken scripts are right now moment.js and bootstrap datetimepicker.

Uncaught TypeError: Cannot set property 'moment' of undefined(anonymous function) @ common-1e3de0f4.js:1(anonymous function) @ common-1e3de0f4.js:1 create:207

Uncaught TypeError: $(...).datetimepicker is not a function

It must have something do to with the fact that I did npm update because all my custom scripts are fine - just these plugins are broken - while I haven't touched them.

I saw that every file is now preceded by 'use strict'; Previously it never happened before.

I really would like to solve it by myself but I have no idea where to start looking for a solution.

My gulpfile.js http://pastebin.com/NQ8f9tGr

Thanks for any help.


Solution

  • This is known issue, in fact Jeffrey is asking for feedback how people want to solve this, you can find more info here and give your opinion.

    Also quoting Jeffrey Way on a possible solution:

    We have two options:

    1. You may disable Babel support, if you don't desire it. elixir.config.babel.enabled = false.
    2. We can blacklist "useStrict", so that it doesn't get included. Not sure we should do this, but it's an option.