getPaths.js 745 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = getPaths;
  6. function getPaths(context) {
  7. const {
  8. stats,
  9. options
  10. } = context;
  11. const childStats = stats.stats ? stats.stats : [stats];
  12. const publicPaths = [];
  13. for (const {
  14. compilation
  15. } of childStats) {
  16. // The `output.path` is always present and always absolute
  17. const outputPath = compilation.getPath(compilation.outputOptions.path);
  18. const publicPath = options.publicPath ? compilation.getPath(options.publicPath) : compilation.outputOptions.publicPath ? compilation.getPath(compilation.outputOptions.publicPath) : "";
  19. publicPaths.push({
  20. outputPath,
  21. publicPath
  22. });
  23. }
  24. return publicPaths;
  25. }