gpt4 book ai didi

meteor - 如何调试 Meteor 插件文件?

转载 作者:行者123 更新时间:2023-12-02 03:28:27 31 4
gpt4 key购买 nike

  • 我关注了 Meteor Doc注册插件包。

  • package/plugin/文件夹中创建了一个插件文件

  • 在该文件中添加了一个调试器;

  • 运行 $ meteor debug;

问题:调试器; 指令被忽略。如何调试插件文件?

谢谢!


plugin/compile-atscript.js:

Plugin.registerSourceHandler(
'ats'
, function (compileStep) {
var source = compileStep.read().toString('utf8');
console.log('source: ' + source);
debugger;
console.log('compiled source: ' + source);
});

最佳答案

Meteor 工具在进程中运行构建插件,所以你只需要在调试器下运行它。在 Linux 和 Mac OS X 上,启动器脚本支持 TOOL_NODE_FLAGS variable可用于将参数传递给 Node.js 运行时以启用调试。查看instructions for debugging the Meteor tool ,尽管这些是为了与 Meteor 的 git checkout 一起使用。一个 hacky 快捷方式:

METEOR_INSTALLATION=~/.meteor/packages/meteor-tool/$(meteor --long-version | sed -ne 's/^meteor-tool@//p')/mt-$(meteor --arch)TOOL_NODE_FLAGS=$METEOR_INSTALLATION/dev_bundle/lib/node_modules/node-inspector/bin/node-debug.js $METEOR_INSTALLATION/meteor

(请注意,仅在最后一行使用 meteor 可能不起作用,因为当 Meteor 工具的默认版本为应用程序执行正确的版本时,调试器将再次启动。)

在 Windows 上,对 TOOL_NODE_FLAGS 的支持已添加到 Meteor 1.4.4 的启动器脚本中。如果应用程序使用的是旧版本的 Meteor,则可以手动编辑启动器脚本。开始调试的命令如下所示:

set METEOR_INSTALLATION=%LOCALAPPDATA%\.meteor\packages\meteor-tool\TOOL_VERSION\mt-os.windows.x86_32set TOOL_NODE_FLAGS=%METEOR_INSTALLATION%\dev_bundle\lib\node_modules\node-inspector\bin\node-debug.js%METEOR_INSTALLATION%\meteor.bat

(欢迎其他人添加可复制和粘贴的代码以找出正确的 TOOL_VERSION!)

关于meteor - 如何调试 Meteor 插件文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28899966/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com