Code Monkey home page Code Monkey logo

Comments (8)

leontastic avatar leontastic commented on July 26, 2024 4

Just checking in to report that this issue still occurs with the new RegExp in very obscure scenarios. In the case I encountered, it was caused by this line in the emotion/react repo's createEmotionProps function that uses new Error().stack to update component labels while performing SSR builds with ts-node and next.js.

Interestingly, I was able to intercept the specific file data that caused the error by using local builds of ts-node and a local build of the fork of this repo @cspotcode/source-map-support that ts-node uses, and was not able to reproduce the RangeError with this regex independently with just Node.js.

However, overriding Error.prepareStackTrace to skip source-map-support's sourcemap transformation logic for stack traces demanded by createEmotionProps reliably resolves the error for me:

if (Error.prepareStackTrace) {
  const originalPrepareStackTrace = Error.prepareStackTrace;
  Error.prepareStackTrace = function (error, trace) {
    if (error.stack?.includes('createEmotionProps')) {
      return error.stack;
    }
    return originalPrepareStackTrace(error, trace);
  };
}

Based on this V8 bug I think RegExp.exec only throws RangeError: Maximum call stack size exceeded when backtracking often over large strings, so I think the current RegExp may still be too greedy for certain large inputs.

from node-source-map-support.

SkeLLLa avatar SkeLLLa commented on July 26, 2024 1

This issue is still present. Are there any plans for fixing this?

Here's more detailed stacktrace, if it helps:

"RangeError: Maximum call stack size exceeded"
  "at RegExp.exec (<anonymous>)",
  "at RegExp.[Symbol.match] (native)",
  "at String.match (native)",
  "at urlParse (/myproject/node_modules/source-map-support/node_modules/source-map/lib/util.js:33:20)",
  "at normalize (/myproject/node_modules/source-map-support/node_modules/source-map/lib/util.js:82:13)",
  "at Object.join (/myproject/node_modules/source-map-support/node_modules/source-map/lib/util.js:174:7)",
  "at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/myproject/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:621:27)",
  "at mapSourcePosition (/myproject/node_modules/source-map-support/source-map-support.js:195:42)"

from node-source-map-support.

LinusU avatar LinusU commented on July 26, 2024 1

This should be fixed in version 0.5.13, please report back if the issue persists!

from node-source-map-support.

tanem avatar tanem commented on July 26, 2024

Whoops, just realised this will probably be fixed by #86. Will check tomorrow.

from node-source-map-support.

gibbtek avatar gibbtek commented on July 26, 2024

I can confirm I have the same issue. It happens randomly i.e. not every run.

The line that causes it for me is when executing the regex:

/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg

  • node-source-map-support: 0.4.16
  • Ionic App
  • karma-source-map-support: 1.2.0
  • jasmine: 2.7.0

from node-source-map-support.

telb99 avatar telb99 commented on July 26, 2024

This is still a problem with Angular 7 unit tests, which uses jasmine, karma, and webpack and creates very large bundles, on a small project, the bundle for vendor.js is over 17MB.

from node-source-map-support.

darrengriffinhut42 avatar darrengriffinhut42 commented on July 26, 2024

I agree with @telb99. This i still an issue in Angular 8 and needs fixing. @LinusU, please resolve.

from node-source-map-support.

LinusU avatar LinusU commented on July 26, 2024

Happy to receive a PR for this 🙌

from node-source-map-support.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.