Dashboard sipadu mbip
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

get-output-directory.js 851B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var path = require('path'),
  3. fs = require('fs'),
  4. objectPath = require('object-path');
  5. var getContextDirectory = require('./get-context-directory');
  6. /**
  7. * Infer the compilation output directory from options.
  8. * Relative paths are resolved against the compilation context (or process.cwd() where not specified).
  9. * @this {{options: object}} A loader or compilation
  10. * @returns {undefined|string} The output path string, where defined
  11. */
  12. function getOutputDirectory() {
  13. /* jshint validthis:true */
  14. var base = objectPath.get(this, 'options.output.directory'),
  15. absBase = !!base && path.resolve(getContextDirectory.call(this), base),
  16. isValid = !!absBase && fs.existsSync(absBase) && fs.statSync(absBase).isDirectory();
  17. return isValid ? absBase : undefined;
  18. }
  19. module.exports = getOutputDirectory;