unbuild icon indicating copy to clipboard operation
unbuild copied to clipboard

Transpiled react has invalid regex

Open RossComputerGuy opened this issue 3 years ago • 0 comments

Code

When built with npm run build:js, all of the files in dist/chunks/ have a variable called __rest$[num] with [num] being a random number. This looks to be used for properties in JSX and React. Here's what that generated code looks like:

var __rest$3 = /home/ross/CerusBots/k8s/packages/webapp && /home/ross/CerusBots/k8s/packages/webapp.__rest || function (s, e) {
  var t = {};

  for (var p in s) {
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  }

  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  }
  return t;
};

Is there a solution to fix this and if yes, then how?

RossComputerGuy avatar Jun 05 '22 17:06 RossComputerGuy