getCurrentRequest.js 359 B

12345678910111213141516
  1. 'use strict';
  2. function getCurrentRequest(loaderContext) {
  3. if (loaderContext.currentRequest) {
  4. return loaderContext.currentRequest;
  5. }
  6. const request = loaderContext.loaders
  7. .slice(loaderContext.loaderIndex)
  8. .map((obj) => obj.request)
  9. .concat([loaderContext.resource]);
  10. return request.join('!');
  11. }
  12. module.exports = getCurrentRequest;