@@ -169,11 +169,75 @@ Interpret the entry point as a URL.
169169.It Fl -experimental-addon-modules
170170Enable experimental addon module support.
171171.
172- .It Fl -experimental-config-file
173- Specifies the configuration file to load.
172+ .It Fl -experimental-config-file , Fl -experimental-config-file Ns = Ns Ar config , Fl -experimental-default-config-file
173+ If present, Node.js will look for a configuration file at the specified path.
174+ If the path is not specified, Node.js will look for a \fB node.config.json \fR file
175+ in the current working directory.
176+ To specify a custom path, use the \fB --experimental-config-file= \fR\fB path \fR form.
177+ The space-separated \fB --experimental-config-file path \fR form is not supported.
178+ Node.js will read the configuration file and apply the settings. The
179+ configuration file should be a JSON file with the following structure. \fB vX.Y.Z \fR
180+ in the \fB $schema \fR must be replaced with the version of Node.js you are using.
181+ .Bd -literal
182+ {
183+ "$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json",
184+ "nodeOptions": {
185+ "import": [
186+ "amaro/strip"
187+ ],
188+ "watch-path": "src",
189+ "watch-preserve-output": true
190+ },
191+ "testRunner": {
192+ "test-isolation": "process"
193+ },
194+ "watch": {
195+ "watch-preserve-output": true
196+ }
197+ }
198+ .Ed
199+ The configuration file supports namespace-specific options:
200+ .Bl -bullet
201+ .It
202+ The \fB nodeOptions \fR field contains CLI flags that are allowed in \fB NODE_OPTIONS \fR .
203+ .It
204+ Namespace fields like \fB testRunner \fR contain configuration specific to that subsystem.
205+ .El
206+ No-op flags are not supported.
207+ Not all V8 flags are currently supported.
208+ It is possible to use the official JSON schema
209+ to validate the configuration file, which may vary depending on the Node.js version.
210+ Each key in the configuration file corresponds to a flag that can be passed
211+ as a command-line argument. The value of the key is the value that would be
212+ passed to the flag.
213+ For example, the configuration file above is equivalent to
214+ the following command-line arguments:
215+ .Bd -literal
216+ node --import amaro/strip --watch-path=src --watch-preserve-output --test-isolation=process
217+ .Ed
218+ The priority in configuration is as follows:
219+ .Bl -bullet
220+ .It
221+ NODE_OPTIONS and command-line options
222+ .It
223+ Dotenv NODE_OPTIONS
224+ .It
225+ Configuration file
226+ .El
227+ Values in the configuration file will not override the values in the environment
228+ variables, command-line options, or the \fB NODE_OPTIONS \fR env file parsed by the
229+ \fB --env-file \fR flag.
230+ Keys cannot be duplicated within the same or different namespaces.
231+ The configuration parser will throw an error if the configuration file contains
232+ unknown keys or keys that cannot be used in a namespace.
233+ Node.js will not sanitize or perform validation on the user-provided configuration,
234+ so \fB NEVER \fR use untrusted configuration files.
174235.
175236.It Fl -experimental-default-config-file
176- Enable support for automatically loading node.config.json.
237+ This flag is an alias for \fB --experimental-config-file \fR without an argument.
238+ If present, Node.js will look for a
239+ \fB node.config.json \fR file in the current working directory and load it as a
240+ configuration file.
177241.
178242.It Fl -experimental-import-meta-resolve
179243Enable experimental ES modules support for import.meta.resolve().
0 commit comments