"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; function _react() { const data = _interopRequireDefault(require("react")); _react = function _react() { return data; }; return data; } function _path() { const data = require("path"); _path = function _path() { return data; }; return data; } function _isWindows() { const data = _interopRequireDefault(require("is-windows")); _isWindows = function _isWindows() { return data; }; return data; } function _umiUtils() { const data = require("umi-utils"); _umiUtils = function _umiUtils() { return data; }; return data; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _default(opts = {}) { loadEnv(); let cwd = opts.cwd || process.env.APP_ROOT || process.cwd(); if (cwd) { if (!(0, _path().isAbsolute)(cwd)) { cwd = (0, _path().join)(process.cwd(), cwd); } cwd = (0, _umiUtils().winPath)(cwd); // 原因:webpack 的 include 规则得是 \ 才能判断出是绝对路径 if ((0, _isWindows().default)()) { cwd = cwd.replace(/\//g, '\\'); } } return { cwd }; } function loadEnv() { const basePath = (0, _path().join)(process.cwd(), '.env'); const localPath = `${basePath}.local`; (0, _umiUtils().loadDotEnv)(localPath); (0, _umiUtils().loadDotEnv)(basePath); }