Rollup: Throw on Warning

Created on 19 Jul 2017  Â·  1Comment  Â·  Source: rollup/rollup


I've been using Rollup in a project that is using Lerna to manage package dependencies.

The flow of this set up is:

  1. Call lerna bootstrap
  2. Lerna will run npm run prepublish in each package as well as npm link
  3. In the npm run prepublish step I have a rollup call: "prepublish": "rollup -c"

What I noticed is that warnings are swallowed by Lerna and actually resulted in a bad build, is there anyway to throw on a warning with the CLI?

Most helpful comment

yep — you can use a custom onwarn handler for that:

// rollup.config.js
export default {
  // ...
  onwarn: warning => {
    throw new Error(warning.message);
  }
};

>All comments

yep — you can use a custom onwarn handler for that:

// rollup.config.js
export default {
  // ...
  onwarn: warning => {
    throw new Error(warning.message);
  }
};
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jodarove picture jodarove  Â·  3Comments

Havunen picture Havunen  Â·  3Comments

nanomosfet picture nanomosfet  Â·  3Comments

otakustay picture otakustay  Â·  3Comments

Uyarn picture Uyarn  Â·  3Comments