From 740286552960acec44534db33002a414259fb9aa Mon Sep 17 00:00:00 2001 From: benswinburne Date: Tue, 20 Feb 2024 11:40:26 -0500 Subject: [PATCH] refactor: move require statements to make esbuild understand them https://esbuild.github.io/api/#non-analyzable-imports --- index.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 3c4a727..f940721 100644 --- a/index.js +++ b/index.js @@ -36,20 +36,20 @@ if (typeof String.endsWith !== "function") { let Lemmatizer = function() { this.wn_files = { noun: [ - './dict/index.noun.json', - './dict/noun.exc.json' + require('./dict/index.noun.json'), + require('./dict/noun.exc.json'), ], verb: [ - './dict/index.verb.json', - './dict/verb.exc.json' + require('./dict/index.verb.json'), + require('./dict/verb.exc.json'), ], adj: [ - './dict/index.adj.json', - './dict/adj.exc.json' + require('./dict/index.adj.json'), + require('./dict/adj.exc.json'), ], adv: [ - './dict/index.adv.json', - './dict/adv.exc.json' + require('./dict/index.adv.json'), + require('./dict/adv.exc.json'), ] }; @@ -197,9 +197,8 @@ Lemmatizer.prototype = { }); }, - open_file: function(key, file) { + open_file: function(key, data) { if (!programStorage.getItem(key)) { - let data = require(`${file}`); this.store_data(key, JSON.stringify(data)); } }, @@ -449,4 +448,4 @@ Lemmatizer.prototype = { let lemmatizer = new Lemmatizer(); -module.exports = lemmatizer; \ No newline at end of file +module.exports = lemmatizer;