UNPKG

webpack-bootstrap

Version:

Easily implement webpack for any kind of front-end app

35 lines (25 loc) 807 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.configDetect = undefined; var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs); var _path = require('path'); var _path2 = _interopRequireDefault(_path); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const configDetect = exports.configDetect = function (initCwd) { let targetCwd = initCwd; let configPath; while (targetCwd !== '/') { const fileConfigPath = _path2.default.resolve(targetCwd, '.wbootrc'); if (_fs2.default.existsSync(fileConfigPath)) { configPath = fileConfigPath; break; } else { targetCwd = _path2.default.resolve(targetCwd, '..'); } } return configPath; }; exports.default = configDetect;