MCPcopy
hub / github.com/webpack/webpack / _getEnvFilesForMode

Method _getEnvFilesForMode

lib/DotenvPlugin.js:298–308  ·  view source on GitHub ↗

* Get list of env files to load based on mode and template * Similar to Vite's getEnvFilesForMode * @private * @param {InputFileSystem} inputFileSystem the input file system * @param {string | false} dir the directory containing .env files * @param {string | undefined} mode the mode (e.g.,

(inputFileSystem, dir, mode)

Source from the content-addressed store, hash-verified

296 * @returns {string[]} array of file paths to load
297 */
298 _getEnvFilesForMode(inputFileSystem, dir, mode) {
299 if (!dir) {
300 return [];
301 }
302
303 const templates = this.options.template || DEFAULT_TEMPLATE;
304
305 return templates
306 .map((pattern) => pattern.replace(/\[mode\]/g, mode || "development"))
307 .map((file) => join(inputFileSystem, dir, file));
308 }
309
310 /**
311 * Get parsed env variables from `.env` files

Callers 1

_getParsedMethod · 0.95

Calls 2

joinFunction · 0.85
replaceMethod · 0.45

Tested by

no test coverage detected