0

After build the TypeScript using tsdx and doing the minify with NUglify I start to get the error Strict-mode does not allow assignment to undefined variables: regeneratorRuntime.

try {
  regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
  // This module should not be running in strict mode, so the above
  // assignment should always work unless something is misconfigured. Just
  // in case runtime.js accidentally runs in strict mode, we can escape
  // strict mode using a global Function call. This could conceivably fail
  // if a Content Security Policy forbids using Function, but in that case
  // the proper solution is to fix the accidental strict mode problem. If
  // you've misconfigured your bundler to force strict mode and applied a
  // CSP to forbid Function, and you're not willing to fix either of those
  // problems, please detail your unique predicament in a GitHub issue.
  Function("r", "regeneratorRuntime = r")(runtime);
}
});

How can I fix this error not having to just ignore it?

Pablo
  • 1,953
  • 4
  • 28
  • 57
  • Declare it before you use it. Either `let`, `var` or `const` are valid ways to declare a variable. Since you get that error - it is being interpreted as strict. If this is not intended - we need more information to say why it is when you think it shouldn't – fredrik Aug 16 '21 at 11:10
  • @fredrik, you are right! Thanks – Pablo Aug 16 '21 at 11:33

0 Answers0