Programmers learn & share
0 votes
256 views

Problem :

I am running Laravel 5.4 on my Homestead vagrant box but when I want to run npm run production I am getting the following error

block-scoped declarations (let, const, function, class) not yet supported outside strict mode.

by (6.9k points)   | 256 views

1 Answer

0 votes

Solution :

I had faced the same problem in the recent past with one of my test script in NodeJS and i was able to resolved my error with the use of ECMAScript 5's strict mode.
"use strict";

I had added above line at the top of my script and it works really well.

Strict mode makes various changes to normal JavaScript semantics as follows:

  1. It eliminates some JavaScript silent errors by just changing them to throw errors.

  2. Fixes mistakes that will make it difficult for JavaScript engines to perform optimizations: strict mode code can be made to run faster than identical code that is not strict mode.

  3. It also prohibits some syntax likely to be defined in future versions of ECMAScript.

by (36.1k points)  
2,245 questions
2,807 answers
60 comments
241 users