调试JavaScript缩小错误(在Liferay 6.2中) [英] Debugging JavaScript minification errors (in Liferay 6.2)

查看:89
本文介绍了调试JavaScript缩小错误(在Liferay 6.2中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Liferay 6.2.尝试使用最佳实践,而JS压缩是其中之一.

Liferay 6.2. tries to use best practices and JS minification is one of them.

但是当未缩小的JavaScript工作并且缩小产生这样的错误时(在Tomcat控制台中),您会怎么做:

But what do you do when your unminified JavaScript works and minification produces errors like this (in Tomcat console):

12:23:48,794 ERROR [http-bio-8080-exec-10][MinifierUtil:111] 607: 21: identifier is a reserved word
12:23:48,797 ERROR [http-bio-8080-exec-10][MinifierUtil:111] 608: 45: identifier is a reserved word
12:23:48,802 ERROR [http-bio-8080-exec-10][MinifierUtil:111] 1: 0: Compilation produced 2 syntax errors.
12:23:48,805 ERROR [http-bio-8080-exec-10][MinifierUtil:88] JavaScript Minifier failed for_________    AUI().use('node', 'aui-base', 'aui-io-request', 'aui

[MinifierUtil:111] 607:21:和[MinifierUtil:111] 608:45:不是您的代码(jsp/ftl/...)中的行号,正如人们期望从控制台日志和谷歌搜索标识符是一个保留字"或"JavaScript Minifier失败_________"对我几乎没有任何帮助(好的,我知道 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords 正常).

[MinifierUtil:111] 607: 21: and [MinifierUtil:111] 608: 45: are not line numbers in your code (jsp/ftl/...) as man expects from console log and googling "identifier is a reserved word" or "JavaScript Minifier failed for_________" helped me almost nothing (ok, I knew about https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords normally).

<script></script>之间的代码粘贴到JS lint或提示或任何其他JS工具不是一个选项,因为它包含许多JAVA和spring/freemarker/liferay标签等...

Pasting code between <script> and </script> to JS lint or hint or any other JS tool is not an option as it contains many JAVA and spring/freemarker/liferay tags etc...

所以-我的问题是-由于我无法找到最佳实践/方法来进行调试-您的看法是什么(或者甚至更好-经验:))?

So - my question is - as I wasn't able to find best practices / methodologies for debugging this - what is your opinion (or even better - experience :)) ?

推荐答案

好吧,您以另一种方式解决了这个问题-您(或其他人)应该再遇到一些问题:

Well, you solved the problem in another way - just some pointers should you (or someone else) run into this issue again:

Minifier在这些错误消息中报告行号和偏移量,但它们与Minifier看到的内容有关-例如不在您的JSP,FTL或其他文件中,而是在传递给压缩程序的任何文件中.

Minifier reports Line number and Offset in these error messages, but they're related to the content that the minifier sees - e.g. not in your JSP, FTL or other file, but in whatever gets passed to the minifier.

读取缩小程序日志的方法是:

The way to read the minifier log is:

  • 第607行第21列以及第608行第45列有问题
  • 在下面的行中,您看到JavaScript Minifier failed for_________ AUI().use('node', 'aui-base', 'aui-io-request', 'aui,这是minifier看到的内容的第一部分-找到此代码,您可能能够识别将哪些内容传递给minifier并向下计数( ,从那里跳下607行)
  • Line 607, column 21 as well as Line 608, column 45 have a problem
  • In the following line, you see JavaScript Minifier failed for_________ AUI().use('node', 'aui-base', 'aui-io-request', 'aui which is the first part of the content that the minifier sees - locating this code, you might be able to identify which content gets passed to the minifier and count down the lines (well, jump down 607 lines from there)

侧面问题:与@Origineil同意,启动时间实际上指向您遇到的另一个问题-除非您故意在启动时运行进程,否则应该没有那么多.例如.如果您正在运行集群,并且每台计算机都保留自己的Lucene索引,则必须在启动时重新索引.如果要解决此问题,则可能不需要两个索引.但这只是一个例子,您并没有要求这样做.我只想添加一些指针.我假设您已经调整了JVM内存设置,并且没有使用默认捆绑软件的设置来运行它?

Side issues: Agreeing with @Origineil that the startup time rather points to another issue that you have - it shouldn't be that much unless you deliberately have processes running at startup. E.g. if you're running a cluster and each machine keeps its own lucene index, you must reindex at startup. If you want to work around that, two indexes might not be what you're after. But it's only an example, and you didn't ask for this. I just wanted to add some pointers. I assume that you have tuned your JVM memory settings already and are not running with the default bundle's settings?

这篇关于调试JavaScript缩小错误(在Liferay 6.2中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆