Food-Static-Data / sd

Food static data wrapper
GNU General Public License v3.0
9 stars 14 forks source link

es5 import "/files.js" don't use our babel module resolving feature that can make our code less long #279

Open atherdon opened 5 years ago

atherdon commented 5 years ago

When I'm looking at this file, i see a long path resolving each time. https://github.com/GroceriStar/sd/blob/master/files.js But we have a module resolver, that aiming to simplify including of files. Am I right that module resolving not working well for this file, or maybe we just forget to use it? Please advice.

vadim9999 commented 5 years ago

module resolver returns just full path to file that is stored on hdd.But the reason to use es5 it's due to require. that give to it path and returns object. But to make easier to use module resolver I have add filesObject.js that return array with all data

atherdon commented 5 years ago

Can we replace right now

const grocery = path.resolve(__dirname, './src/data/Grocery/grocery.json')

with

const grocery = path.resolve(__dirname, '~/Grocery/grocery.json')

without crashing everything? Don't do it - just tell what do you think

vadim9999 commented 5 years ago

I think we can replace but I am a little doubte. ~ alias is working in es6 fine. But will it be working in es5 I don't test it.

atherdon commented 5 years ago

ok, i think it can be a good task for someone else. i think all is clear and we don't need to spend time on it.