Skip to content

Commit

Permalink
fix(rollup): allow config files to override default onwarn method
Browse files Browse the repository at this point in the history
Fixes #2084
  • Loading branch information
jbedard authored and alexeagle committed Sep 9, 2020
1 parent 45f710f commit 0b80f6a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/rollup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@ function extractEnvironmentVariables(vars) {
// input: https://rollupjs.org/guide/en/#inputoptions-object
// output: https://rollupjs.org/guide/en/#outputoptions-object
async function parseCLIArgs(args) {
let inputOptions = {
// Options which the CLI args or config file can override
const defaultInputOptions = {
onwarn(...warnArgs) {
worker.log(...warnArgs);
},
};

// Options which can override the config file
let inputOptions = {};

let outputOptions = {};

let configFile = null;
Expand Down Expand Up @@ -194,6 +198,9 @@ async function parseCLIArgs(args) {
delete inputOptions.output;
}

// Provide default inputOptions which can be overwritten
inputOptions = {...defaultInputOptions, ...inputOptions};

// The inputs are the rule entry_point[s]
inputOptions.input = inputs;

Expand Down

0 comments on commit 0b80f6a

Please sign in to comment.