Javascript PhantomJS-使用System.import加载js文件时出错
这里有一个问题:我正在使用phamtomJS 2.1.1,我想打开在reactJS+typescript上编写的网页,我在System.import期间收到一个异常 index.html的代码:Javascript PhantomJS-使用System.import加载js文件时出错,javascript,phantomjs,systemjs,Javascript,Phantomjs,Systemjs,这里有一个问题:我正在使用phamtomJS 2.1.1,我想打开在reactJS+typescript上编写的网页,我在System.import期间收到一个异常 index.html的代码: <div id="__Mount"></div> <script src="lib/systemjs/dist/system.src.js"></script> <script src="lib/react/dist/phantomjs-shims
<div id="__Mount"></div>
<script src="lib/systemjs/dist/system.src.js"></script>
<script src="lib/react/dist/phantomjs-shims.js"></script>
<!-- build:js -->
<!-- endbuild -->
<!-- build:systemjs_config -->
<script>
System.config({
baseURL: './lib',
paths: {
"react*": 'react/dist/react-with-addons',
"react-dom": 'react-dom/dist/react-dom',
"jquery": 'kendoui/js/jquery.min',
"bootstrap": 'bootstrap/dist/js/npm'
}
});
System.defaultJSExtensions = true;
</script>
<!-- endbuild -->
<script>
System.import('client/mount').catch(function(e)
{
console.error(e);
});
</script>
这给了我一个错误:
错误:ERROR:(SystemJS)eval@[本机代码]
__执行官@
执行@
链接动态模块@
链接@
执行@
多迪动力执行@
链接@
多林克@
updateLinkSetOnLoad@
评价
加载错误
test.js的代码:
var page = require('webpage').create();
page.onError = function(msg) {
console.log("On error message "+msg);
};
page.open('http://127.0.0.1:8080/', function (status) {
console.log("status is: " + status);
if (status === "success") {
console.log("success");
setTimeout(function () {
console.log("screenshot");
page.render('screenshot.png');
var js = page.evaluate(function () {
return document;
});
console.log(js.all[0].outerHTML);
phantom.exit();
}, 10000);
}
else {
console.log("not success");
phantom.exit();
}
});
我真的被它迷住了,我找不到办法。任何帮助或提示都将不胜感激。根据github上的问题,此功能尚不受支持: 所以我决定选择电子 现在它对我来说很好,它启动了我的单元测试,但没有显示出完美的UI
phantomjs test.js http://127.0.0.1:8080
var page = require('webpage').create();
page.onError = function(msg) {
console.log("On error message "+msg);
};
page.open('http://127.0.0.1:8080/', function (status) {
console.log("status is: " + status);
if (status === "success") {
console.log("success");
setTimeout(function () {
console.log("screenshot");
page.render('screenshot.png');
var js = page.evaluate(function () {
return document;
});
console.log(js.all[0].outerHTML);
phantom.exit();
}, 10000);
}
else {
console.log("not success");
phantom.exit();
}
});