mirror of https://github.com/webpack/webpack.git
(fix): support win platform
This commit is contained in:
parent
fabcaede17
commit
baafdc189f
|
|
@ -8,8 +8,8 @@
|
|||
const browserslist = require("browserslist");
|
||||
const path = require("path");
|
||||
|
||||
// query|[/path/to/config][:env]
|
||||
const inputRx = /^(?:(.+?))?(?::(.+?))?$/;
|
||||
// [[C:]/path/to/config][:env]
|
||||
const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/;
|
||||
|
||||
/**
|
||||
* @typedef {Object} BrowserslistHandlerConfig
|
||||
|
|
@ -57,14 +57,13 @@ const parse = input => {
|
|||
return { configPath, env };
|
||||
}
|
||||
|
||||
const [, queryOrEnv] = inputRx.exec(input) || [];
|
||||
const config = browserslist.findConfig(process.cwd());
|
||||
|
||||
if (config && Object.keys(config).includes(queryOrEnv)) {
|
||||
return { env: queryOrEnv };
|
||||
if (config && Object.keys(config).includes(input)) {
|
||||
return { env: input };
|
||||
}
|
||||
|
||||
return { query: queryOrEnv };
|
||||
return { query: input };
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ const TARGETS = [
|
|||
/^browserslist(?::(.+))?$/,
|
||||
rest => {
|
||||
return browserslistTargetHandler.resolve(
|
||||
browserslistTargetHandler.parse(rest)
|
||||
browserslistTargetHandler.parse(rest ? rest.trim() : null)
|
||||
);
|
||||
}
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue