enable backward-compatibility for resolve.roots
This commit is contained in:
parent
ef75c04070
commit
79de1a2166
|
@ -683,6 +683,10 @@ export interface ResolveOptions {
|
|||
fileSystem?: {
|
||||
[k: string]: any;
|
||||
};
|
||||
/**
|
||||
* Enable to ignore fatal errors happening during resolving of 'resolve.roots'. Usually such errors should not happen, but this option is provided for backward-compatibility.
|
||||
*/
|
||||
ignoreRootsErrors?: boolean;
|
||||
/**
|
||||
* Field names from the description file (package.json) which are used to find the default entry point
|
||||
*/
|
||||
|
@ -703,6 +707,10 @@ export interface ResolveOptions {
|
|||
* Plugins for the resolver
|
||||
*/
|
||||
plugins?: (WebpackPluginInstance | WebpackPluginFunction)[];
|
||||
/**
|
||||
* Prefer to resolve server-relative URLs (starting with '/') as absolute paths before falling back to resolve in 'resolve.roots'.
|
||||
*/
|
||||
preferAbsolute?: boolean;
|
||||
/**
|
||||
* Custom resolver
|
||||
*/
|
||||
|
@ -710,7 +718,7 @@ export interface ResolveOptions {
|
|||
[k: string]: any;
|
||||
};
|
||||
/**
|
||||
* A list of directories in which requests that are server-relative URLs (starting with '/') are resolved. On non-windows system these requests are tried to resolve as absolute path first.
|
||||
* A list of directories in which requests that are server-relative URLs (starting with '/') are resolved.
|
||||
*/
|
||||
roots?: string[];
|
||||
/**
|
||||
|
|
|
@ -356,6 +356,16 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|||
options.resolve.plugins.length > 0
|
||||
);
|
||||
});
|
||||
this.set(
|
||||
"resolve.preferAbsolute",
|
||||
"make",
|
||||
options => !options.resolve.roots || options.resolve.roots.length === 0
|
||||
);
|
||||
this.set(
|
||||
"resolve.ignoreRootsErrors",
|
||||
"make",
|
||||
options => !options.resolve.roots || options.resolve.roots.length === 0
|
||||
);
|
||||
this.set("resolve.roots", "make", options => [options.context]);
|
||||
|
||||
this.set("resolveLoader", "call", value => Object.assign({}, value));
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"ajv": "^6.10.2",
|
||||
"ajv-keywords": "^3.4.1",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^4.3.0",
|
||||
"enhanced-resolve": "^4.5.0",
|
||||
"eslint-scope": "^4.0.3",
|
||||
"json-parse-better-errors": "^1.0.2",
|
||||
"loader-runner": "^2.4.0",
|
||||
|
|
|
@ -1179,6 +1179,10 @@
|
|||
"fileSystem": {
|
||||
"description": "Filesystem for the resolver"
|
||||
},
|
||||
"ignoreRootsErrors": {
|
||||
"description": "Enable to ignore fatal errors happening during resolving of 'resolve.roots'. Usually such errors should not happen, but this option is provided for backward-compatibility.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"mainFields": {
|
||||
"description": "Field names from the description file (package.json) which are used to find the default entry point",
|
||||
"anyOf": [
|
||||
|
@ -1226,11 +1230,15 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"preferAbsolute": {
|
||||
"description": "Prefer to resolve server-relative URLs (starting with '/') as absolute paths before falling back to resolve in 'resolve.roots'.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"resolver": {
|
||||
"description": "Custom resolver"
|
||||
},
|
||||
"roots": {
|
||||
"description": "A list of directories in which requests that are server-relative URLs (starting with '/') are resolved. On non-windows system these requests are tried to resolve as absolute path first.",
|
||||
"description": "A list of directories in which requests that are server-relative URLs (starting with '/') are resolved.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Directory in which requests that are server-relative URLs (starting with '/') are resolved.",
|
||||
|
|
|
@ -2015,10 +2015,10 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0:
|
|||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
enhanced-resolve@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz#3b806f3bfafc1ec7de69551ef93cca46c1704126"
|
||||
integrity sha512-3e87LvavsdxyoCfGusJnrZ5G8SLPOFeHSNpZI/ATL9a5leXo2k0w6MKnbqhdBad9qTobSfB20Ld7UmgoNbAZkQ==
|
||||
enhanced-resolve@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz#2f3cfd84dbe3b487f18f2db2ef1e064a571ca5ec"
|
||||
integrity sha512-Nv9m36S/vxpsI+Hc4/ZGRs0n9mXqSWGGq49zxb/cJfPAQMbUtttJAlNPS4AQzaBdw/pKskw5bMbekT/Y7W/Wlg==
|
||||
dependencies:
|
||||
graceful-fs "^4.1.2"
|
||||
memory-fs "^0.5.0"
|
||||
|
|
Loading…
Reference in New Issue