-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Invalid string concatenation breaks Lodash _.template method #413
Milestone
Comments
stropitek
added a commit
to NPellet/visualizer
that referenced
this issue
Mar 30, 2017
This reverts commit 9577010. We should wait for babel/minify#413 to be solved
Other escaping related issue: #440 |
@boopathi Any hint when this will be fixed? |
boopathi
added a commit
that referenced
this issue
Apr 3, 2017
Merged
boopathi
added a commit
that referenced
this issue
Apr 4, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minifing the Lodash library using Babili 0.0.11 breaks the
_.template
method.The string concatenation in that method (https://github.com/lodash/lodash/blob/4.17.4/lodash.js#L14748) is minified to contain extraneous escape characters.
Input:
Output:
source='function('+(variable||'obj')+') {\n'+(variable?'':'obj || (obj = {});\n')+'var __t, __p = \'\''+(isEscaping?', __e = _.escape':'')+(isEvaluating?', __j = Array.prototype.join;\\nfunction print() { __p += __j.call(arguments, \\\'\\\') }\\n':';\n')+source+'return __p\n}';
Notice extra escape in
\\n
which results in\n
in function body afterArray.prototype.join
:... Array.prototype.join; \nfunction print() {...
That causes
SyntaxError: Invalid or unexpected token
when function is executed.The text was updated successfully, but these errors were encountered: