Skip to content

Commit 8cc3e69

Browse files
committed
fix: incorrect resolve ignoring folder/files, close #317
1 parent 7a4e8dc commit 8cc3e69

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/cfg-resolve.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,28 @@ export default ({input, flags = {}}) => {
2525
use = [].concat(use).reduce((cfg, name) => {
2626
let cliOptions = flags[toCamelCase(name)];
2727
let configOptions = configPluginOptions[name];
28+
2829
// We merge this way because options can be both strings and objects.
29-
const merged = mergeOptions({ [name]: configOptions }, { [name]: cliOptions || {}});
30+
const merged = mergeOptions({[name]: configOptions}, {[name]: cliOptions || {}});
31+
3032
// Assigning as we loop `use` makes sure that the order in cfg.plugins is correct.
3133
cfg.plugins[name] = merged[name];
34+
3235
if (configOptions) {
3336
delete configPluginOptions[name];
3437
}
38+
3539
return cfg;
36-
}, { plugins: {} });
40+
}, {plugins: {}});
3741

3842
// Add the remaining plugins if there is any.
3943
if (config && config.plugins) {
4044
for (let name in configPluginOptions) {
41-
use.plugins[name] = configPluginOptions[name];
45+
if (configPluginOptions[name]) {
46+
use.plugins[name] = configPluginOptions[name];
47+
}
4248
}
49+
4350
// Now all the plugins are in `use.plugins`.
4451
// Delete `config.plugins` for correct merging later: mergeOptions(config, {...}, use)
4552
delete config.plugins;
@@ -53,7 +60,17 @@ export default ({input, flags = {}}) => {
5360
input = []
5461
.concat(input && input.length > 0 ? input : config?.input)
5562
.filter(Boolean)
56-
.map(file => path.join(path.resolve(root), file));
63+
.map(file => {
64+
const ignoreFile = file.startsWith('!');
65+
let ignoreSymbol = '';
66+
67+
if (ignoreFile) {
68+
ignoreSymbol = '!';
69+
file = file.slice(1);
70+
}
71+
72+
return path.join(ignoreSymbol, path.resolve(root), file);
73+
});
5774

5875
if (input.length === 0) {
5976
throw new TypeError('input files not found');

0 commit comments

Comments
 (0)