Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"multiple" import leads maximum call stack #1928

Closed
Xowap opened this issue Mar 18, 2014 · 5 comments
Closed

"multiple" import leads maximum call stack #1928

Xowap opened this issue Mar 18, 2014 · 5 comments

Comments

@Xowap
Copy link

Xowap commented Mar 18, 2014

Hi all,

We have been encountering an issue with imports since the upgrade to v1.7.0

Here is what we do have in our code

@import (reference) "my_bootstrap.less";

@import "bootstrap/less/normalize.less";
@import "bootstrap/less/print.less";
@import "bootstrap/less/utilities.less";
@import "bootstrap/less/grid.less";

We do this to load the various mixins and UI elements as mixins (reference import), but still want to include the grid and some other classes that are useful and do not need to be re-written.

Yet, the upgrade to v1.7.0 has broken this, and the grid (plus other stuff) is not printed anymore. We have been able to pinpoint the apparition of this behavior in ccd8ebb.

Since it looks like that this change is due to the import defaulting to once, we have set the import to multiple. However, this leads to a SyntaxError: Maximum call stack size exceeded.

To be able to reproduce the issue, we have created a set of files

lib.less

@import "mixins";
@import "utils";

mixins.less

.stuff() {
  color: red;
}

root.less

@import (reference) "lib";
@import (multiple) "utils";

utils.less

.stuff {
  .stuff();
}

In this example, the expected output of both lib.less and root.less is

.stuff {
  color: red;
}

However, when processing root.less, the compiler outputs the following error

SyntaxError: Maximum call stack size exceeded in less-import-bug/utils.less on line 2, column 3:
1 .stuff {
2   .stuff();
3 }

I understand that the pointed commit brings consistency, but this breaks the use we currently had of LESS. Can this be fixed if considered as a bug, or can you provide a replacement solution?

Many thanks

@seven-phases-max
Copy link
Member

I.e. this is basically the same issue as #1914 (just hidden behind reference + multiple).

Updated: I mean #1915 actually (#1914 is similar but its initial example was never allowed, while #1915 examples worked before 1.6.0).

@Xowap
Copy link
Author

Xowap commented Mar 18, 2014

@seven-phases-max it indeed looks so

If it is of any help, I can confirm that the exact code of my 4 test files do work flawlessly in beb5273, yet fails in ccd8ebb as stated, which is the commit right after. In other words, even with the multiple keyword it worked, which I hadn't tested until now.

I also had a look at #1915, which seems to appear at 6d3414d, which comes from much earlier.

Yet, the only way I can kind of reproduce #1914 is through my example, which asks the question to know if it happens under the same circumstances, but I'll ask it in the other issue itself.

@seven-phases-max
Copy link
Member

Yes, you're right. The offensive commit is 6d3414d - I see the bug there now.
P.S. and thanks for the commits hint, it helped a lot.

@Xowap
Copy link
Author

Xowap commented Mar 19, 2014

You're welcome :)

So it seems that indeed ccd8ebb did just bring up the bug introduced in 6d3414d

@lukeapage
Copy link
Member

Let me know if I shouldn't have closed this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants