我正在看https://github.com/intoli/remote-browser。我正在使用节点11.5在win10中工作。我正在通过将以下内容添加到src / index.js
中来测试代码import Browser from './browser';
import ConnectionProxy from './connections/proxy';
export default Browser;
export { Browser };
export { ConnectionProxy };
export * from './errors';
export * from './launchers';
// eslint-disable-next-line no-restricted-globals
process.stdout.write('hello:there ');
// const { Browser } = require('remote-browser');
// const browser = new Browser();
// browser.listen().then(port => console.log('Listening on port', port));
(async () => {
// Create and launch a new browser instance.
const browser = new Browser();
await browser.launch();
// Directly access the Web Extensions API from a remote client.
const tab = await browser.tabs.create({ url: 'https://intoli.com' });
const screenshot = await browser.tabs.captureVisibleTab();
})();
您可以看到选项卡和屏幕截图都从未在屏幕截图中读取,但这导致:
$ yarn build
yarn run v1.17.3
$ Set NODE_ENV=production&&webpack --config webpack
clean-webpack-plugin: E:\ENVS\js\remote-browser\dist\extension has been removed.
Hash: 9cc6d50b90cbe6cd42f3f79034e4ca9daf45a4d0
Version: webpack 3.8.1
Child
Hash: 9cc6d50b90cbe6cd42f3
Time: 5548ms
Asset Size Chunks Chunk Names
background.js 233 kB 0 [emitted] background
content.js 36.3 kB 1 [emitted] content
popup.js 30.9 kB 2 [emitted] popup
background.js.map 292 kB 0 [emitted] background
content.js.map 45.7 kB 1 [emitted] content
popup.js.map 39.2 kB 2 [emitted] popup
manifest.json 1.24 kB [emitted]
popup.html 1.22 kB [emitted]
popup.css 466 bytes [emitted]
...................................
..................................
ERROR in ./src/index.js
E:\ENVS\js\remote-browser\src\index.js
21:9 error 'tab' is assigned a value but never used no-unused-vars
22:9 error 'screenshot' is assigned a value but never used no-unused-vars
✖ 2 problems (2 errors, 0 warnings)
error Command failed with exit code 2.
该如何解决?
答案 0 :(得分:0)
实际错误是在 webpack 中产生的,并且隐藏了
它们可以显示为here所示:
似乎由于某种原因,错误被故意隐藏了。如果将错误和errordetails更改为true,则可能会发现阻止webpack正常运行的原因。
尝试在配置中的stats对象中添加 errorDetails:true