mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: use string literal in require
for index.js (#1511)
Use string literals for `require` statement in `index.js` so that tools can determine the dependency tree.
This commit is contained in:
parent
c58c70eac0
commit
42fd41c499
11
index.js
11
index.js
@ -14,12 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// If node does not support async await, use the compiled version.
|
||||
let folder = 'lib';
|
||||
let asyncawait = true;
|
||||
try {
|
||||
new Function('async function test(){await 1}');
|
||||
} catch (error) {
|
||||
folder = 'node6';
|
||||
asyncawait = false;
|
||||
}
|
||||
|
||||
module.exports = require(`./${folder}/Puppeteer`);
|
||||
// If node does not support async await, use the compiled version.
|
||||
if (asyncawait)
|
||||
module.exports = require('./lib/Puppeteer');
|
||||
else
|
||||
module.exports = require('./node6/Puppeteer');
|
||||
|
Loading…
Reference in New Issue
Block a user