You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Critical dependency warning on a require.resolve #1099
This seems related to #1083. If I understand correctly, webpack can't import(...) or require a pure variable e.g. import(varName) because there's no way to determine what group of files are being referred to. However, something like:
import('./directory/${varName}.css')
gives webpack enough information to go bundle all css files from ./directory and make them accessible as require-able modules when the variable is actually defined. @webpack/documentation-team is this correct?
My understanding is that import('./directory/${varName}.css') sets up a require.context internally. If you had import(varName), how could you tell statically where to point in the file system?
@dkfiresky based on the old docs, it seems require.resolve does not behave exactly like require and instead returns the id for that module. However, after a quick search, I couldn't find anything in the new docs analogous to the page I just linked to. I'm not too familiar with require.resolve in webpack so we'd have to check with the rest of @webpack/documentation-team, but it seems maybe we should add a similar page in the new /content/api section?
I'd be happy to try to port this page over if someone gives me some pointers on what is and isn't still relevant.
Activity
skipjack commentedon Apr 11, 2017
This seems related to #1083. If I understand correctly, webpack can't
import(...)orrequirea pure variable e.g.import(varName)because there's no way to determine what group of files are being referred to. However, something like:gives webpack enough information to go bundle all css files from
./directoryand make them accessible asrequire-able modules when the variable is actually defined. @webpack/documentation-team is this correct?bebraw commentedon Apr 11, 2017
My understanding is that
import('./directory/${varName}.css')sets up arequire.contextinternally. If you hadimport(varName), how could you tell statically where to point in the file system?simon04 commentedon Apr 19, 2017
With #1110 merged, is there anything left to be done?
skipjack commentedon Apr 27, 2017
@dkfiresky based on the old docs, it seems
require.resolvedoes not behave exactly likerequireand instead returns the id for that module. However, after a quick search, I couldn't find anything in the new docs analogous to the page I just linked to. I'm not too familiar withrequire.resolvein webpack so we'd have to check with the rest of @webpack/documentation-team, but it seems maybe we should add a similar page in the new/content/apisection?I'd be happy to try to port this page over if someone gives me some pointers on what is and isn't still relevant.