Highlight.js: Webpack error with autoit.js: Maximum call stack size exceeded

Created on 4 Aug 2015  Â·  21Comments  Â·  Source: highlightjs/highlight.js

I'm not sure if this is a highlight.js problem or webpack, but when webpack attempts to bundle highlight.js version 8.7, it chokes on autoit.js:

ERROR in ../~/highlight.js/lib/languages/autoit.js
Module build failed: Maximum call stack size exceeded
 @ ../~/highlight.js/lib/index.js 12:32-61

Had to pin to ~8.6.0 to get around this. Using node 0.10.25.

bug

Most helpful comment

I resolved it in webpack config file by adding to module.noParse option new RegExp, e.g. like this:

{
    //...other config options
    module: {
       noParse: [/autoit.js/],
       //...other config options
    },
}

All 21 comments

Can you please provide all actions that you do? Unfortunatly at least me and @isagalaev are not familiar with modern packaging tools :-(

To add more details to what @Sannis said…

highlight.js is a bit of a special case as it's supposed to be built with its internal tool first to become a working library. There are several kinds of build targets for different environment (browsers, node.js). So the answer to your question here depends very much on what webpack does. However I tend to think it's webpack's problem anyway as "maximum call stack exceeded" is a run-time problem and highlight.js code is not executing at that time (or so I dearly hope). Also, no other tool chokes on autoit.js, to my knowledge.

I'm going to close this issue as it doesn't seem we can do anything about it. If anything comes up in the future that we could fix feel free to reopen it. Thanks!

I also have ran into this error. On node v4 using highlight.js v8.8.0 and WebPack v1.12.1. The bigger problem I have with this error is around the inconsistency. Half the time it builds fine, other half it blows up with this error.

Good day. I have the same issue.

ERROR in ./~/highlight.js/lib/languages/autoit.js
Module parse failed: /Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/highlight.js/lib/languages/autoit.js Maximum call stack size exceeded
You may need an appropriate loader to handle this file type.
RangeError: Maximum call stack size exceeded
    at Parser.applyPluginsBailResult (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/tapable/lib/Tapable.js:44:35)
    at Parser.evaluateExpression (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/webpack/lib/Parser.js:711:20)
    at Parser.<anonymous> (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/webpack/lib/Parser.js:60:20)
    at Parser.applyPluginsBailResult (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/tapable/lib/Tapable.js:48:50)
    at Parser.evaluateExpression (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/webpack/lib/Parser.js:711:20)
    at Parser.<anonymous> (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/webpack/lib/Parser.js:60:20)
    at Parser.applyPluginsBailResult (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/tapable/lib/Tapable.js:48:50)
    at Parser.evaluateExpression (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/webpack/lib/Parser.js:711:20)
    at Parser.<anonymous> (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/webpack/lib/Parser.js:60:20)
    at Parser.applyPluginsBailResult (/Users/olegshilov/Documents/actor-platform/actor-apps/app-web/node_modules/tapable/lib/Tapable.js:48:50)
 @ ./~/highlight.js/lib/index.js 13:32-61

I use node v4.1.1, highlight.js v8.8.0, webpack v1.12.2 in my project.
Before update node to v4, I had the same error and it's fixed with adding following lines to webpack config.

  resolve: {
    modulesDirectories: ['node_modules']
  }

But now it's stop working again.

I have the same error on OSX.
Sometimes it goes away, sometimes it comes back.

This is happening for me too.

+1 same problem

I believe the problem is because the file autoit.js has thousands of string concatenations and that is causing web pack to blow it's stack.

+1 reverting to v8.7 fixed it for me

I resolved it in webpack config file by adding to module.noParse option new RegExp, e.g. like this:

{
    //...other config options
    module: {
       noParse: [/autoit.js/],
       //...other config options
    },
}

I tried again with webpack 1.12.2 + highlight.js 8.9.1 and it worked without noParse.

It's nice when things get automagically fixed themselves :-)

The error reappeared after adding an additional dependency to my project. Oddly enough, after restarting webpack --watch, the error did not reappear. My server automatically pulls from GitHub every time I push to master, then runs npm install, triggering a webpack -p postinstall script. It has done that several times without any issues, so it would appear that the error is intermittent. I will try noParse.

@martinjirku Here's a better RegExp: /autoit\.js$/

It seems that it is a wepback issue. Created it: https://github.com/webpack/webpack/issues/1721

yeah this bug makes me really sad lol. Thanks for figuring out the cause.

It looks like this issue is in deadlock. :(

The last comment (from a month ago) on webpack/webpack#1721 was:

highlight.js can use a single multi-line string to avoid the high AST depth. (this is a webpack problem, but if highlight.js doesn't mind making the change, then yay!)

And the last effective comment here was:

It seems that it is a wepback issue.

highlight.js can use a single multi-line string to avoid the high AST depth. (this is a webpack problem, but if highlight.js doesn't mind making the change, then yay!)

Thanks for bringing this up, it actually helps. I don't see why not do it, and it should be fairly straightforward. I encourage anyone interested to pick it up and submit a pull request.

May also be worth noting that- for me at least- this issue is resolved using the latest Node (6.1.0) although I was encountering it with older versions (5.3.0, 5.9.1).

I looked more closely into AutoIt and found out it is simply too big anyway. I reduced the list based on the official docs of the languages which reduced the size of the whole library by about 20% and as a side effect fixed this issue.

Nice work! :)

@isagalaev I'm using 9.6.0 but this issue is still there https://github.com/MoOx/phenomic/issues/616

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Suyash2810 picture Suyash2810  Â·  8Comments

vladshcherbin picture vladshcherbin  Â·  5Comments

Vad1mo picture Vad1mo  Â·  7Comments

ghost picture ghost  Â·  3Comments

wooorm picture wooorm  Â·  6Comments