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

Strict mode and SyntaxError #392

Closed
SamyPesse opened this issue Mar 10, 2015 · 8 comments
Closed

Strict mode and SyntaxError #392

SamyPesse opened this issue Mar 10, 2015 · 8 comments

Comments

@SamyPesse
Copy link
Contributor

I know almost nothing about consequence of "strict mode" but since #386 has been merged, include Nunjucks in GitbookIO/gitbook crash on OS X and Windows with:

/Users/samypesse/Projects/GitBook/nunjucks/src/precompile.js:61
        function addTemplates(dir) {
        ^^^^^^^^
SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Am I doing something wrong?

@SamyPesse
Copy link
Contributor Author

Ok, I think this is not happening in the tests because none of the tests is including precompile.js but index.jsis.

@SamyPesse
Copy link
Contributor Author

@jlongster I can fix this issue as part of #391

@jlongster
Copy link
Contributor

Ok, thanks. Just convert it into a var addTemplates = function() {}. I think @popomore was going to fix that in a follow-up PR, but feel free to go ahead and fix it.

@SamyPesse
Copy link
Contributor Author

I fixed it: ff075af but maybe my solution is not what you expected, just let me know and I'll change it.

I'm also adding a small test for precompile.js (to avoid this kind of situation).

@nijikokun
Copy link

👍 really need this...

@popomore
Copy link
Contributor

Yes, that's my fault. There is no testcase for precompile, so I don't see any error about this.

@popomore
Copy link
Contributor

Ref #383 (comment)

@popomore
Copy link
Contributor

Thx @SamyPesse

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

4 participants