From 8a0ee11c44306cc2ff228c2a4012bdb7e9c591ff Mon Sep 17 00:00:00 2001 From: Olivier Bacs Date: Sat, 5 Oct 2019 03:33:31 +0100 Subject: [PATCH] Update index.js My build uses Webpack and fails with `TypeError: fetch is not a function`. Webpack and `node-fetch 2.1.2` (in use here) will not use the CommonJS solution by default. Explanations in this thread: https://github.com/bitinn/node-fetch/issues/450#issuecomment-387045223 --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index eebdd6f..6d4b62b 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ const config = require("./config"); -const fetch = require('node-fetch'); +const fetch = require('node-fetch').default; const bt = require('./bullet-train-core'); const bulletTrain = bt({fetch: fetch}); -module.exports = bulletTrain; \ No newline at end of file +module.exports = bulletTrain;