mirror of https://github.com/webpack/webpack.git
Compare commits
7 Commits
4c30c3ee83
...
e9b5f669c9
Author | SHA1 | Date |
---|---|---|
|
e9b5f669c9 | |
|
37ff2904cb | |
|
7d37ce4a0e | |
|
bbcf095dd9 | |
|
3df51cb887 | |
|
ea68eada62 | |
|
e62546989c |
|
@ -315,8 +315,7 @@
|
|||
"spacek",
|
||||
"thelarkinn",
|
||||
"behaviour",
|
||||
"WHATWG",
|
||||
"systemvars"
|
||||
"WHATWG"
|
||||
],
|
||||
"ignoreRegExpList": [
|
||||
"/Author.+/",
|
||||
|
|
|
@ -50,18 +50,7 @@ export type DevTool = (false | "eval") | string;
|
|||
/**
|
||||
* Enable and configure the Dotenv plugin to load environment variables from .env files.
|
||||
*/
|
||||
export type Dotenv =
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
*/
|
||||
envDir?: string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string[] | string;
|
||||
};
|
||||
export type Dotenv = boolean | DotenvPluginOptions;
|
||||
/**
|
||||
* The entry point(s) of the compilation.
|
||||
*/
|
||||
|
@ -1127,6 +1116,19 @@ export interface FileCacheOptions {
|
|||
*/
|
||||
version?: string;
|
||||
}
|
||||
/**
|
||||
* Options for Dotenv plugin.
|
||||
*/
|
||||
export interface DotenvPluginOptions {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.
|
||||
*/
|
||||
dir?: boolean | string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefix?: string[] | string;
|
||||
}
|
||||
/**
|
||||
* Multiple entry bundles are created. The key is the entry name. The value can be a string, an array or an entry description object.
|
||||
*/
|
||||
|
@ -3080,19 +3082,6 @@ export interface CssParserOptions {
|
|||
*/
|
||||
url?: CssParserUrl;
|
||||
}
|
||||
/**
|
||||
* Options for Dotenv plugin.
|
||||
*/
|
||||
export interface DotenvPluginOptions {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
*/
|
||||
envDir?: string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string[] | string;
|
||||
}
|
||||
/**
|
||||
* No generator options are supported for this module type.
|
||||
*/
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn fix:special` to update
|
||||
*/
|
||||
|
||||
export interface DotenvPluginOptions {
|
||||
/**
|
||||
* Whether to allow empty strings in safe mode. If false, will throw an error if any env variables are empty (but only if safe mode is enabled).
|
||||
*/
|
||||
allowEmptyValues?: boolean;
|
||||
/**
|
||||
* Adds support for dotenv-defaults. If set to true, uses ./.env.defaults. If a string, uses that location for a defaults file.
|
||||
*/
|
||||
defaults?: boolean | string;
|
||||
/**
|
||||
* Allows your variables to be "expanded" for reusability within your .env file.
|
||||
*/
|
||||
expand?: boolean;
|
||||
/**
|
||||
* The path to your environment variables. This same path applies to the .env.example and .env.defaults files.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* The prefix to use before the name of your env variables.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* If true, load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.
|
||||
*/
|
||||
safe?: boolean | string;
|
||||
/**
|
||||
* Set to true if you would rather load all system variables as well (useful for CI purposes).
|
||||
*/
|
||||
systemvars?: boolean;
|
||||
}
|
|
@ -12,9 +12,10 @@ const { join } = require("./util/fs");
|
|||
/** @typedef {import("./Compiler")} Compiler */
|
||||
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
||||
|
||||
/** @type {DotenvPluginOptions} */
|
||||
const DEFAULT_OPTIONS = {
|
||||
prefixes: "WEBPACK_",
|
||||
envDir: true
|
||||
prefix: "WEBPACK_",
|
||||
dir: true
|
||||
};
|
||||
|
||||
// Regex for parsing .env files
|
||||
|
@ -206,18 +207,18 @@ function expand(options) {
|
|||
/**
|
||||
* Resolve and validate env prefixes
|
||||
* Similar to Vite's resolveEnvPrefix
|
||||
* @param {string | string[] | undefined} rawPrefixes raw prefixes option
|
||||
* @param {string | string[] | undefined} rawPrefix raw prefix option
|
||||
* @returns {string[]} normalized prefixes array
|
||||
*/
|
||||
const resolveEnvPrefix = (rawPrefixes) => {
|
||||
const prefixes = Array.isArray(rawPrefixes)
|
||||
? rawPrefixes
|
||||
: [rawPrefixes || "WEBPACK_"];
|
||||
const resolveEnvPrefix = (rawPrefix) => {
|
||||
const prefixes = Array.isArray(rawPrefix)
|
||||
? rawPrefix
|
||||
: [rawPrefix || "WEBPACK_"];
|
||||
|
||||
// Check for empty prefix (security issue like Vite does)
|
||||
if (prefixes.includes("")) {
|
||||
throw new Error(
|
||||
"prefixes option contains value '', which could lead to unexpected exposure of sensitive information."
|
||||
"prefix option contains value '', which could lead to unexpected exposure of sensitive information."
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -228,18 +229,18 @@ const resolveEnvPrefix = (rawPrefixes) => {
|
|||
* Get list of env files to load based on mode
|
||||
* Similar to Vite's getEnvFilesForMode
|
||||
* @param {InputFileSystem} inputFileSystem the input file system
|
||||
* @param {string} envDir the directory containing .env files
|
||||
* @param {string} dir the directory containing .env files
|
||||
* @param {string | undefined} mode the mode (e.g., 'production', 'development')
|
||||
* @returns {string[]} array of file paths to load
|
||||
*/
|
||||
const getEnvFilesForMode = (inputFileSystem, envDir, mode) => {
|
||||
if (envDir) {
|
||||
const getEnvFilesForMode = (inputFileSystem, dir, mode) => {
|
||||
if (dir) {
|
||||
return [
|
||||
/** default file */ ".env",
|
||||
/** local file */ ".env.local",
|
||||
/** mode file */ `.env.${mode}`,
|
||||
/** mode local file */ `.env.${mode}.local`
|
||||
].map((file) => join(inputFileSystem, envDir, file));
|
||||
].map((file) => join(inputFileSystem, dir, file));
|
||||
}
|
||||
|
||||
return [];
|
||||
|
@ -321,30 +322,33 @@ class DotenvPlugin {
|
|||
* @returns {void}
|
||||
*/
|
||||
loadEnv(fs, mode, context, callback) {
|
||||
const { envDir: rawEnvDir, prefixes: rawPrefixes } =
|
||||
const { dir: rawDir, prefix: rawPrefix } =
|
||||
/** @type {DotenvPluginOptions} */ (this.config);
|
||||
|
||||
let prefixes;
|
||||
try {
|
||||
prefixes = resolveEnvPrefix(rawPrefixes);
|
||||
prefixes = resolveEnvPrefix(rawPrefix);
|
||||
} catch (err) {
|
||||
return callback(/** @type {Error} */ (err));
|
||||
}
|
||||
|
||||
const getEnvDir = () => {
|
||||
if (typeof rawEnvDir === "string") {
|
||||
return join(fs, context, rawEnvDir);
|
||||
const getDir = () => {
|
||||
if (typeof rawDir === "string") {
|
||||
return join(fs, context, rawDir);
|
||||
}
|
||||
if (rawEnvDir === true) {
|
||||
if (rawDir === true) {
|
||||
return context;
|
||||
}
|
||||
if (rawDir === false) {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const envDir = getEnvDir();
|
||||
const dir = getDir();
|
||||
|
||||
// Get env files to load
|
||||
const envFiles = getEnvFilesForMode(fs, envDir, mode);
|
||||
const envFiles = getEnvFilesForMode(fs, dir, mode);
|
||||
/** @type {string[]} */
|
||||
const fileDependencies = [];
|
||||
|
||||
|
|
|
@ -178,9 +178,7 @@ const getNormalizedWebpackOptions = (config) => ({
|
|||
return { ...devServer };
|
||||
}),
|
||||
devtool: config.devtool,
|
||||
dotenv: optionalNestedConfig(config.dotenv, (dotenv) =>
|
||||
dotenv === true ? {} : dotenv
|
||||
),
|
||||
dotenv: config.dotenv,
|
||||
entry:
|
||||
config.entry === undefined
|
||||
? { main: {} }
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -640,8 +640,7 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/DotenvPluginOptions",
|
||||
"description": "Options for Dotenv plugin."
|
||||
"$ref": "#/definitions/DotenvPluginOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -650,17 +649,25 @@
|
|||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"envDir": {
|
||||
"description": "The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
"dir": {
|
||||
"description": "The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"prefixes": {
|
||||
"prefix": {
|
||||
"description": "Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A prefix that environment variables must start with to be exposed.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ describe("snapshots", () => {
|
|||
"dependencies": undefined,
|
||||
"devServer": undefined,
|
||||
"devtool": false,
|
||||
"dotenv": undefined,
|
||||
"entry": Object {
|
||||
"main": Object {
|
||||
"import": Array [
|
||||
|
|
|
@ -79,7 +79,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration should be an object:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user."
|
||||
`)
|
||||
);
|
||||
|
@ -88,7 +88,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration should be an object:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user."
|
||||
`)
|
||||
);
|
||||
|
@ -251,7 +251,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration has an unknown property 'postcss'. These properties are valid:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user.
|
||||
For typos: please correct them.
|
||||
For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
|
||||
|
@ -494,7 +494,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration has an unknown property 'debug'. These properties are valid:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user.
|
||||
The 'debug' property was removed in webpack 2.0.0.
|
||||
Loaders should be updated to allow passing this option via loader options in module.rules.
|
||||
|
@ -542,7 +542,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration[1] should be an object:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user."
|
||||
`)
|
||||
);
|
||||
|
@ -664,7 +664,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration has an unknown property 'rules'. These properties are valid:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user.
|
||||
Did you mean module.rules?"
|
||||
`)
|
||||
|
@ -679,7 +679,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration has an unknown property 'splitChunks'. These properties are valid:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user.
|
||||
Did you mean optimization.splitChunks?"
|
||||
`)
|
||||
|
@ -694,7 +694,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration has an unknown property 'noParse'. These properties are valid:
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, dotenv?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? }
|
||||
-> Options object as provided by the user.
|
||||
Did you mean module.noParse?"
|
||||
`)
|
||||
|
|
|
@ -478,42 +478,48 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"dotenv-env-dir": Object {
|
||||
"dotenv-dir": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.",
|
||||
"description": "The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.",
|
||||
"multiple": false,
|
||||
"path": "dotenv.envDir",
|
||||
"path": "dotenv.dir",
|
||||
"type": "boolean",
|
||||
},
|
||||
Object {
|
||||
"description": "The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.",
|
||||
"multiple": false,
|
||||
"path": "dotenv.dir",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.",
|
||||
"description": "The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.",
|
||||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"dotenv-prefixes": Object {
|
||||
"dotenv-prefix": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"description": "A prefix that environment variables must start with to be exposed.",
|
||||
"multiple": true,
|
||||
"path": "dotenv.prefixes[]",
|
||||
"path": "dotenv.prefix[]",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"description": "A prefix that environment variables must start with to be exposed.",
|
||||
"multiple": true,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"dotenv-prefixes-reset": Object {
|
||||
"dotenv-prefix-reset": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Clear all items provided in 'dotenv.prefixes' configuration. Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"description": "Clear all items provided in 'dotenv.prefix' configuration. Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"multiple": false,
|
||||
"path": "dotenv.prefixes",
|
||||
"path": "dotenv.prefix",
|
||||
"type": "reset",
|
||||
},
|
||||
],
|
||||
"description": "Clear all items provided in 'dotenv.prefixes' configuration. Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"description": "Clear all items provided in 'dotenv.prefix' configuration. Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
|
|
|
@ -671,4 +671,4 @@ Before we started using OpenCollective, donations were made anonymously. Now tha
|
|||
[dependency-review-url]: https://github.com/webpack/webpack/actions/workflows/dependency-review.yml
|
||||
[dependency-review]: https://github.com/webpack/webpack/actions/workflows/dependency-review.yml/badge.svg
|
||||
[cover]: https://codecov.io/gh/webpack/webpack/graph/badge.svg?token=mDP3mQJNnn
|
||||
[cover-url]: https://codecov.io/gh/webpack/webpack
|
||||
[cover-url]: https://codecov.io/gh/webpack/webpack
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
it("should load from custom envDir", () => {
|
||||
it("should load from custom dir", () => {
|
||||
expect(process.env.WEBPACK_FROM_ENVS).toBe("loaded-from-envs-dir");
|
||||
expect(process.env.WEBPACK_API_URL).toBe("https://custom.example.com");
|
||||
});
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
it("should not load any .env files when dir is false", () => {
|
||||
// When dir: false, no .env files should be loaded
|
||||
// Only environment variables that were already set in process.env should be available
|
||||
// and only those with WEBPACK_ prefix should be exposed
|
||||
|
||||
// These should be undefined since no .env files are loaded
|
||||
expect(typeof process.env.WEBPACK_API_URL).toBe("undefined");
|
||||
expect(typeof process.env.WEBPACK_MODE).toBe("undefined");
|
||||
expect(typeof process.env.SECRET_KEY).toBe("undefined");
|
||||
expect(typeof process.env.PRIVATE_VAR).toBe("undefined");
|
||||
|
||||
// Only pre-existing process.env variables with WEBPACK_ prefix should be available
|
||||
// (if any were set before webpack runs)
|
||||
});
|
|
@ -16,13 +16,13 @@ module.exports = [
|
|||
entry: "./expand.js",
|
||||
dotenv: true
|
||||
},
|
||||
// Test 3: Custom envDir - load from different directory
|
||||
// Test 3: Custom dir - load from different directory
|
||||
{
|
||||
name: "custom-envdir",
|
||||
name: "custom-dir",
|
||||
mode: "development",
|
||||
entry: "./custom-envdir.js",
|
||||
dotenv: {
|
||||
envDir: "./envs"
|
||||
dir: "./envs"
|
||||
}
|
||||
},
|
||||
// Test 4: Custom prefixes - multiple prefixes
|
||||
|
@ -31,8 +31,8 @@ module.exports = [
|
|||
mode: "development",
|
||||
entry: "./custom-prefixes.js",
|
||||
dotenv: {
|
||||
envDir: "./prefixes-env",
|
||||
prefixes: ["APP_", "CONFIG_"]
|
||||
dir: "./prefixes-env",
|
||||
prefix: ["APP_", "CONFIG_"]
|
||||
}
|
||||
},
|
||||
// Test 5: Mode-specific - .env.[mode] overrides
|
||||
|
@ -41,5 +41,14 @@ module.exports = [
|
|||
mode: "production",
|
||||
entry: "./mode-specific.js",
|
||||
dotenv: true
|
||||
},
|
||||
// Test 6: Disabled dir - dir: false disables .env file loading
|
||||
{
|
||||
name: "disabled-dir",
|
||||
mode: "development",
|
||||
entry: "./disabled-dir.js",
|
||||
dotenv: {
|
||||
dir: false
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
|
@ -24,7 +24,7 @@ import {
|
|||
ClassBody,
|
||||
ClassDeclaration,
|
||||
ClassExpression,
|
||||
Comment,
|
||||
Comment as CommentImport,
|
||||
ConditionalExpression,
|
||||
ContinueStatement,
|
||||
DebuggerStatement,
|
||||
|
@ -99,9 +99,11 @@ import {
|
|||
} from "inspector";
|
||||
import { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
|
||||
import { ListenOptions } from "net";
|
||||
import { validate as validateFunction } from "schema-utils";
|
||||
import {
|
||||
ValidationErrorConfiguration,
|
||||
validate as validateFunction
|
||||
} from "schema-utils";
|
||||
import { default as ValidationError } from "schema-utils/declarations/ValidationError";
|
||||
import { ValidationErrorConfiguration } from "schema-utils/declarations/validate";
|
||||
import {
|
||||
AsArray,
|
||||
AsyncParallelHook,
|
||||
|
@ -114,7 +116,8 @@ import {
|
|||
SyncBailHook,
|
||||
SyncHook,
|
||||
SyncWaterfallHook,
|
||||
TapOptions
|
||||
TapOptions,
|
||||
TypedHookMap
|
||||
} from "tapable";
|
||||
import { SecureContextOptions, TlsOptions } from "tls";
|
||||
import { URL } from "url";
|
||||
|
@ -297,6 +300,14 @@ declare interface Asset {
|
|||
*/
|
||||
info: AssetInfo;
|
||||
}
|
||||
declare abstract class AssetBytesGenerator extends Generator {
|
||||
generateError(
|
||||
error: Error,
|
||||
module: NormalModule,
|
||||
generateContext: GenerateContext
|
||||
): null | Source;
|
||||
}
|
||||
declare abstract class AssetBytesParser extends ParserClass {}
|
||||
declare interface AssetDependencyMeta {
|
||||
sourceType: "css-url";
|
||||
}
|
||||
|
@ -311,6 +322,25 @@ type AssetFilterItemTypes =
|
|||
| string
|
||||
| RegExp
|
||||
| ((name: string, asset: StatsAsset) => boolean);
|
||||
declare abstract class AssetGenerator extends Generator {
|
||||
dataUrlOptions?:
|
||||
| AssetGeneratorDataUrlOptions
|
||||
| ((
|
||||
source: string | Buffer,
|
||||
context: { filename: string; module: Module }
|
||||
) => string);
|
||||
filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
||||
publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
||||
outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
||||
emit?: boolean;
|
||||
getMimeType(module: NormalModule): string;
|
||||
generateDataUri(module: NormalModule): string;
|
||||
generateError(
|
||||
error: Error,
|
||||
module: NormalModule,
|
||||
generateContext: GenerateContext
|
||||
): null | Source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options object for data url generation.
|
||||
|
@ -349,6 +379,15 @@ declare interface AssetInlineGeneratorOptions {
|
|||
context: { filename: string; module: Module }
|
||||
) => string);
|
||||
}
|
||||
declare abstract class AssetParser extends ParserClass {
|
||||
dataUrlCondition?:
|
||||
| boolean
|
||||
| AssetParserDataUrlOptions
|
||||
| ((
|
||||
source: string | Buffer,
|
||||
context: { filename: string; module: Module }
|
||||
) => boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options object for DataUrl condition.
|
||||
|
@ -404,6 +443,14 @@ declare interface AssetResourceGeneratorOptions {
|
|||
*/
|
||||
publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
||||
}
|
||||
declare abstract class AssetSourceGenerator extends Generator {
|
||||
generateError(
|
||||
error: Error,
|
||||
module: NormalModule,
|
||||
generateContext: GenerateContext
|
||||
): null | Source;
|
||||
}
|
||||
declare abstract class AssetSourceParser extends ParserClass {}
|
||||
declare class AsyncDependenciesBlock extends DependenciesBlock {
|
||||
constructor(
|
||||
groupOptions:
|
||||
|
@ -473,6 +520,7 @@ declare interface AsyncWebAssemblyModulesPluginOptions {
|
|||
*/
|
||||
mangleImports?: boolean;
|
||||
}
|
||||
declare abstract class AsyncWebAssemblyParser extends ParserClass {}
|
||||
declare class AutomaticPrefetchPlugin {
|
||||
constructor();
|
||||
|
||||
|
@ -2044,6 +2092,11 @@ declare interface ColorsOptions {
|
|||
*/
|
||||
useColor?: boolean;
|
||||
}
|
||||
declare interface CommentCssParser {
|
||||
value: string;
|
||||
range: [number, number];
|
||||
loc: { start: Position; end: Position };
|
||||
}
|
||||
declare interface CommonJsImportSettings {
|
||||
name?: string;
|
||||
context: string;
|
||||
|
@ -2950,18 +3003,7 @@ declare interface Configuration {
|
|||
/**
|
||||
* Enable and configure the Dotenv plugin to load environment variables from .env files.
|
||||
*/
|
||||
dotenv?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
*/
|
||||
envDir?: string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string | string[];
|
||||
};
|
||||
dotenv?: boolean | DotenvPluginOptions;
|
||||
|
||||
/**
|
||||
* The entry point(s) of the compilation.
|
||||
|
@ -3574,6 +3616,23 @@ declare interface CssData {
|
|||
*/
|
||||
exports: Map<string, string>;
|
||||
}
|
||||
declare abstract class CssGenerator extends Generator {
|
||||
convention?:
|
||||
| "as-is"
|
||||
| "camel-case"
|
||||
| "camel-case-only"
|
||||
| "dashes"
|
||||
| "dashes-only"
|
||||
| ((name: string) => string);
|
||||
localIdentName?: string;
|
||||
exportsOnly?: boolean;
|
||||
esModule?: boolean;
|
||||
generateError(
|
||||
error: Error,
|
||||
module: NormalModule,
|
||||
generateContext: GenerateContext
|
||||
): null | Source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generator options for css modules.
|
||||
|
@ -3769,6 +3828,19 @@ declare class CssModulesPlugin {
|
|||
): TemplatePath;
|
||||
static chunkHasCss(chunk: Chunk, chunkGraph: ChunkGraph): boolean;
|
||||
}
|
||||
declare abstract class CssParser extends ParserClass {
|
||||
defaultMode: "global" | "auto" | "pure" | "local";
|
||||
import: boolean;
|
||||
url: boolean;
|
||||
namedExports: boolean;
|
||||
comments?: CommentCssParser[];
|
||||
magicCommentContext: Context;
|
||||
getComments(range: [number, number]): CommentCssParser[];
|
||||
parseCommentOptions(range: [number, number]): {
|
||||
options: null | Record<string, any>;
|
||||
errors: null | (Error & { comment: CommentCssParser })[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Parser options for css modules.
|
||||
|
@ -4356,13 +4428,13 @@ declare class DotenvPlugin {
|
|||
constructor(options?: DotenvPluginOptions);
|
||||
config: {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
* The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.
|
||||
*/
|
||||
envDir: string | boolean;
|
||||
dir?: string | boolean;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes: string | string[];
|
||||
prefix?: string | string[];
|
||||
};
|
||||
apply(compiler: Compiler): void;
|
||||
|
||||
|
@ -4392,14 +4464,14 @@ declare class DotenvPlugin {
|
|||
*/
|
||||
declare interface DotenvPluginOptions {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
* The directory from which .env files are loaded. Can be an absolute path, or a path relative to the project root. false will disable the .env file loading.
|
||||
*/
|
||||
envDir?: string;
|
||||
dir?: string | boolean;
|
||||
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string | string[];
|
||||
prefix?: string | string[];
|
||||
}
|
||||
declare class DynamicEntryPlugin {
|
||||
constructor(context: string, entry: () => Promise<EntryStaticNormalized>);
|
||||
|
@ -6659,6 +6731,33 @@ declare interface IteratorObject<T, TReturn = unknown, TNext = unknown>
|
|||
[Symbol.iterator](): IteratorObject<T, TReturn, TNext>;
|
||||
[Symbol.dispose](): void;
|
||||
}
|
||||
declare abstract class JavascriptGenerator extends Generator {
|
||||
generateError(
|
||||
error: Error,
|
||||
module: NormalModule,
|
||||
generateContext: GenerateContext
|
||||
): null | Source;
|
||||
sourceModule(
|
||||
module: Module,
|
||||
initFragments: InitFragment<GenerateContext>[],
|
||||
source: ReplaceSource,
|
||||
generateContext: GenerateContext
|
||||
): void;
|
||||
sourceBlock(
|
||||
module: Module,
|
||||
block: DependenciesBlock,
|
||||
initFragments: InitFragment<GenerateContext>[],
|
||||
source: ReplaceSource,
|
||||
generateContext: GenerateContext
|
||||
): void;
|
||||
sourceDependency(
|
||||
module: Module,
|
||||
dependency: Dependency,
|
||||
initFragments: InitFragment<GenerateContext>[],
|
||||
source: ReplaceSource,
|
||||
generateContext: GenerateContext
|
||||
): void;
|
||||
}
|
||||
declare class JavascriptModulesPlugin {
|
||||
constructor(options?: object);
|
||||
options: object;
|
||||
|
@ -7143,15 +7242,15 @@ declare class JavascriptParser extends ParserClass {
|
|||
[LogicalExpression],
|
||||
boolean | void
|
||||
>;
|
||||
program: SyncBailHook<[Program, Comment[]], boolean | void>;
|
||||
program: SyncBailHook<[Program, CommentImport[]], boolean | void>;
|
||||
terminate: SyncBailHook<[ReturnStatement | ThrowStatement], boolean | void>;
|
||||
finish: SyncBailHook<[Program, Comment[]], boolean | void>;
|
||||
finish: SyncBailHook<[Program, CommentImport[]], boolean | void>;
|
||||
unusedStatement: SyncBailHook<[Statement], boolean | void>;
|
||||
}>;
|
||||
sourceType: "module" | "auto" | "script";
|
||||
scope: ScopeInfo;
|
||||
state: ParserState;
|
||||
comments?: Comment[];
|
||||
comments?: CommentImport[];
|
||||
semicolons?: Set<number>;
|
||||
statementPath?: StatementPathItem[];
|
||||
prevStatement?:
|
||||
|
@ -7975,7 +8074,7 @@ declare class JavascriptParser extends ParserClass {
|
|||
| MaybeNamedClassDeclaration,
|
||||
commentsStartPos: number
|
||||
): boolean;
|
||||
getComments(range: [number, number]): Comment[];
|
||||
getComments(range: [number, number]): CommentImport[];
|
||||
isAsiPosition(pos: number): boolean;
|
||||
setAsiPosition(pos: number): void;
|
||||
unsetAsiPosition(pos: number): void;
|
||||
|
@ -8011,7 +8110,7 @@ declare class JavascriptParser extends ParserClass {
|
|||
evaluatedVariable(tagInfo: TagInfo): VariableInfo;
|
||||
parseCommentOptions(range: [number, number]): {
|
||||
options: null | Record<string, any>;
|
||||
errors: null | (Error & { comment: Comment })[];
|
||||
errors: null | (Error & { comment: CommentImport })[];
|
||||
};
|
||||
extractMemberExpressionChain(
|
||||
expression:
|
||||
|
@ -8363,6 +8462,14 @@ declare abstract class JsonData {
|
|||
| JsonValueFs[];
|
||||
updateHash(hash: Hash): void;
|
||||
}
|
||||
declare abstract class JsonGenerator extends Generator {
|
||||
options: JsonGeneratorOptions;
|
||||
generateError(
|
||||
error: Error,
|
||||
module: NormalModule,
|
||||
generateContext: GenerateContext
|
||||
): null | Source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generator options for json modules.
|
||||
|
@ -8373,6 +8480,17 @@ declare interface JsonGeneratorOptions {
|
|||
*/
|
||||
JSONParse?: boolean;
|
||||
}
|
||||
declare interface JsonModulesPluginParserOptions {
|
||||
/**
|
||||
* The depth of json dependency flagged as `exportInfo`.
|
||||
*/
|
||||
exportsDepth?: number;
|
||||
|
||||
/**
|
||||
* Function that executes for a module source string and should return json-compatible data.
|
||||
*/
|
||||
parse?: (input: string) => any;
|
||||
}
|
||||
declare interface JsonObjectFs {
|
||||
[index: string]:
|
||||
| undefined
|
||||
|
@ -8393,6 +8511,9 @@ declare interface JsonObjectTypes {
|
|||
| JsonObjectTypes
|
||||
| JsonValueTypes[];
|
||||
}
|
||||
declare abstract class JsonParser extends ParserClass {
|
||||
options: JsonModulesPluginParserOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parser options for JSON modules.
|
||||
|
@ -11324,6 +11445,225 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
|
|||
],
|
||||
Module
|
||||
>;
|
||||
createParser: TypedHookMap<
|
||||
Record<
|
||||
"javascript/auto",
|
||||
SyncBailHook<[JavascriptParserOptions], JavascriptParser>
|
||||
> &
|
||||
Record<
|
||||
"javascript/dynamic",
|
||||
SyncBailHook<[JavascriptParserOptions], JavascriptParser>
|
||||
> &
|
||||
Record<
|
||||
"javascript/esm",
|
||||
SyncBailHook<[JavascriptParserOptions], JavascriptParser>
|
||||
> &
|
||||
Record<"json", SyncBailHook<[JsonParserOptions], JsonParser>> &
|
||||
Record<"asset", SyncBailHook<[AssetParserOptions], AssetParser>> &
|
||||
Record<
|
||||
"asset/inline",
|
||||
SyncBailHook<[EmptyParserOptions], AssetParser>
|
||||
> &
|
||||
Record<
|
||||
"asset/resource",
|
||||
SyncBailHook<[EmptyParserOptions], AssetParser>
|
||||
> &
|
||||
Record<
|
||||
"asset/source",
|
||||
SyncBailHook<[EmptyParserOptions], AssetSourceParser>
|
||||
> &
|
||||
Record<
|
||||
"asset/bytes",
|
||||
SyncBailHook<[EmptyParserOptions], AssetBytesParser>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/async",
|
||||
SyncBailHook<[EmptyParserOptions], AsyncWebAssemblyParser>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/sync",
|
||||
SyncBailHook<[EmptyParserOptions], WebAssemblyParser>
|
||||
> &
|
||||
Record<"css", SyncBailHook<[CssParserOptions], CssParser>> &
|
||||
Record<"css/auto", SyncBailHook<[CssAutoParserOptions], CssParser>> &
|
||||
Record<
|
||||
"css/module",
|
||||
SyncBailHook<[CssModuleParserOptions], CssParser>
|
||||
> &
|
||||
Record<
|
||||
"css/global",
|
||||
SyncBailHook<[CssGlobalParserOptions], CssParser>
|
||||
> &
|
||||
Record<string, SyncBailHook<[ParserOptions], ParserClass>>
|
||||
>;
|
||||
parser: TypedHookMap<
|
||||
Record<
|
||||
"javascript/auto",
|
||||
SyncBailHook<[JavascriptParser, JavascriptParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"javascript/dynamic",
|
||||
SyncBailHook<[JavascriptParser, JavascriptParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"javascript/esm",
|
||||
SyncBailHook<[JavascriptParser, JavascriptParserOptions], void>
|
||||
> &
|
||||
Record<"json", SyncBailHook<[JsonParser, JsonParserOptions], void>> &
|
||||
Record<"asset", SyncBailHook<[AssetParser, AssetParserOptions], void>> &
|
||||
Record<
|
||||
"asset/inline",
|
||||
SyncBailHook<[AssetParser, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/resource",
|
||||
SyncBailHook<[AssetParser, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/source",
|
||||
SyncBailHook<[AssetSourceParser, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/bytes",
|
||||
SyncBailHook<[AssetBytesParser, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/async",
|
||||
SyncBailHook<[AsyncWebAssemblyParser, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/sync",
|
||||
SyncBailHook<[WebAssemblyParser, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<"css", SyncBailHook<[CssParser, CssParserOptions], void>> &
|
||||
Record<
|
||||
"css/auto",
|
||||
SyncBailHook<[CssParser, CssAutoParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"css/module",
|
||||
SyncBailHook<[CssParser, CssModuleParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"css/global",
|
||||
SyncBailHook<[CssParser, CssGlobalParserOptions], void>
|
||||
> &
|
||||
Record<string, SyncBailHook<[ParserClass, ParserOptions], void>>
|
||||
>;
|
||||
createGenerator: TypedHookMap<
|
||||
Record<
|
||||
"javascript/auto",
|
||||
SyncBailHook<[EmptyGeneratorOptions], JavascriptGenerator>
|
||||
> &
|
||||
Record<
|
||||
"javascript/dynamic",
|
||||
SyncBailHook<[EmptyGeneratorOptions], JavascriptGenerator>
|
||||
> &
|
||||
Record<
|
||||
"javascript/esm",
|
||||
SyncBailHook<[EmptyGeneratorOptions], JavascriptGenerator>
|
||||
> &
|
||||
Record<"json", SyncBailHook<[JsonGeneratorOptions], JsonGenerator>> &
|
||||
Record<"asset", SyncBailHook<[AssetGeneratorOptions], AssetGenerator>> &
|
||||
Record<
|
||||
"asset/inline",
|
||||
SyncBailHook<[AssetGeneratorOptions], AssetGenerator>
|
||||
> &
|
||||
Record<
|
||||
"asset/resource",
|
||||
SyncBailHook<[AssetGeneratorOptions], AssetGenerator>
|
||||
> &
|
||||
Record<
|
||||
"asset/source",
|
||||
SyncBailHook<[EmptyGeneratorOptions], AssetSourceGenerator>
|
||||
> &
|
||||
Record<
|
||||
"asset/bytes",
|
||||
SyncBailHook<[EmptyGeneratorOptions], AssetBytesGenerator>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/async",
|
||||
SyncBailHook<[EmptyParserOptions], Generator>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/sync",
|
||||
SyncBailHook<[EmptyParserOptions], Generator>
|
||||
> &
|
||||
Record<"css", SyncBailHook<[CssGeneratorOptions], CssGenerator>> &
|
||||
Record<
|
||||
"css/auto",
|
||||
SyncBailHook<[CssAutoGeneratorOptions], CssGenerator>
|
||||
> &
|
||||
Record<
|
||||
"css/module",
|
||||
SyncBailHook<[CssModuleGeneratorOptions], CssGenerator>
|
||||
> &
|
||||
Record<
|
||||
"css/global",
|
||||
SyncBailHook<[CssGlobalGeneratorOptions], CssGenerator>
|
||||
> &
|
||||
Record<string, SyncBailHook<[GeneratorOptions], Generator>>
|
||||
>;
|
||||
generator: TypedHookMap<
|
||||
Record<
|
||||
"javascript/auto",
|
||||
SyncBailHook<[JavascriptGenerator, EmptyGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"javascript/dynamic",
|
||||
SyncBailHook<[JavascriptGenerator, EmptyGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"javascript/esm",
|
||||
SyncBailHook<[JavascriptGenerator, EmptyGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"json",
|
||||
SyncBailHook<[JsonGenerator, JsonGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset",
|
||||
SyncBailHook<[AssetGenerator, AssetGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/inline",
|
||||
SyncBailHook<[AssetGenerator, AssetGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/resource",
|
||||
SyncBailHook<[AssetGenerator, AssetGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/source",
|
||||
SyncBailHook<[AssetSourceGenerator, EmptyGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"asset/bytes",
|
||||
SyncBailHook<[AssetBytesGenerator, EmptyGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/async",
|
||||
SyncBailHook<[Generator, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"webassembly/sync",
|
||||
SyncBailHook<[Generator, EmptyParserOptions], void>
|
||||
> &
|
||||
Record<"css", SyncBailHook<[CssGenerator, CssGeneratorOptions], void>> &
|
||||
Record<
|
||||
"css/auto",
|
||||
SyncBailHook<[CssGenerator, CssAutoGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"css/module",
|
||||
SyncBailHook<[CssGenerator, CssModuleGeneratorOptions], void>
|
||||
> &
|
||||
Record<
|
||||
"css/global",
|
||||
SyncBailHook<[CssGenerator, CssGlobalGeneratorOptions], void>
|
||||
> &
|
||||
Record<string, SyncBailHook<[Generator, GeneratorOptions], void>>
|
||||
>;
|
||||
createModuleClass: HookMap<
|
||||
SyncBailHook<
|
||||
[
|
||||
|
@ -13196,6 +13536,10 @@ declare interface PnpApi {
|
|||
options: { considerBuiltins: boolean }
|
||||
) => null | string;
|
||||
}
|
||||
declare interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
declare class PrefetchPlugin {
|
||||
constructor(context: string, request?: string);
|
||||
context: null | string;
|
||||
|
@ -17845,6 +18189,7 @@ declare abstract class WeakTupleMap<K extends any[], V> {
|
|||
delete(...args: K): void;
|
||||
clear(): void;
|
||||
}
|
||||
declare abstract class WebAssemblyParser extends ParserClass {}
|
||||
declare interface WebAssemblyRenderContext {
|
||||
/**
|
||||
* the chunk
|
||||
|
@ -18025,18 +18370,7 @@ declare interface WebpackOptionsNormalized {
|
|||
/**
|
||||
* Enable and configure the Dotenv plugin to load environment variables from .env files.
|
||||
*/
|
||||
dotenv?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
*/
|
||||
envDir?: string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string | string[];
|
||||
};
|
||||
dotenv?: boolean | DotenvPluginOptions;
|
||||
|
||||
/**
|
||||
* The entry point(s) of the compilation.
|
||||
|
@ -18241,36 +18575,10 @@ type WebpackOptionsNormalizedWithDefaults = WebpackOptionsNormalized & {
|
|||
} & { recordsInputPath: NonNullable<undefined | string | false> } & {
|
||||
recordsOutputPath:
|
||||
| (string & {
|
||||
dotenv: NonNullable<
|
||||
| undefined
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
*/
|
||||
envDir?: string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string | string[];
|
||||
}
|
||||
>;
|
||||
dotenv: NonNullable<undefined | boolean | DotenvPluginOptions>;
|
||||
})
|
||||
| (false & {
|
||||
dotenv: NonNullable<
|
||||
| undefined
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
|
||||
*/
|
||||
envDir?: string;
|
||||
/**
|
||||
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
|
||||
*/
|
||||
prefixes?: string | string[];
|
||||
}
|
||||
>;
|
||||
dotenv: NonNullable<undefined | boolean | DotenvPluginOptions>;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue