css-modules/css-modules-loader-core

Separating fetching ans parsing

douglasduteil opened this issue · 1 comments

Hi there

It surprised me see that the css-modules is fetching the files right inside the parser.
Would it be possible to isolate the parsing process to just return the files to fetch ?
I feel like the goal here is more parsing :import() and :export() than providing a recursive fetching solution, no ?

What do you think about separating the fetching and the parsing process ?

I think they're pretty intertwined — you don't know which files a module imports until you parse it, but you also need to resolve the import usages (replace i__tmp_var_x with whatever the dependency exports) while you're processing each file. So I don't think there are really two separate steps.

Also, abstracting away the "fetcher", which is basically saying "I need this file. Go get it and tell me what it returns. I'll wait" works pretty well.

Gonna close this, but if you can think of a compelling use-case for splitting them up, post it here and reopen. Thanks!