0

when parcel compile my code it build js file started like this :

"use strict";

// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles

require = function (_require) {
  function require(_x, _x2, _x3) {
    return _require.apply(this, arguments);
  }

  require.toString = function () {
    return _require.toString();
  };

  return require;
}(function (modules, cache, entry) {
...

that code can't run because it try to define variable require without var|let|const in "use strict" mode .

So my qustion is : why it generate bad code like that ?

pery mimon
  • 7,713
  • 6
  • 52
  • 57

1 Answers1

0

So in this tread they say that upgrade node to 8.0.0 or above solve the problem.

In a funny way BTW... it magically remove the use strict from the generated file

pery mimon
  • 7,713
  • 6
  • 52
  • 57