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
  • Loading branch information
jbedard committed Aug 16, 2020
1 parent b97f3e9 commit bc62fa1
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 bc62fa1

Please sign in to comment.