Skip to content

Commit 0b80f6a

Browse files
jbedardalexeagle
authored andcommitted
fix(rollup): allow config files to override default onwarn method
Fixes #2084
1 parent 45f710f commit 0b80f6a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/rollup/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,16 @@ function extractEnvironmentVariables(vars) {
103103
// input: https://rollupjs.org/guide/en/#inputoptions-object
104104
// output: https://rollupjs.org/guide/en/#outputoptions-object
105105
async function parseCLIArgs(args) {
106-
let inputOptions = {
106+
// Options which the CLI args or config file can override
107+
const defaultInputOptions = {
107108
onwarn(...warnArgs) {
108109
worker.log(...warnArgs);
109110
},
110111
};
111112

113+
// Options which can override the config file
114+
let inputOptions = {};
115+
112116
let outputOptions = {};
113117

114118
let configFile = null;
@@ -194,6 +198,9 @@ async function parseCLIArgs(args) {
194198
delete inputOptions.output;
195199
}
196200

201+
// Provide default inputOptions which can be overwritten
202+
inputOptions = {...defaultInputOptions, ...inputOptions};
203+
197204
// The inputs are the rule entry_point[s]
198205
inputOptions.input = inputs;
199206

0 commit comments

Comments
 (0)