Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Warnings don't work with Rollup's onwarn function #84

Closed
Pauan opened this issue Sep 26, 2016 · 0 comments
Closed

Warnings don't work with Rollup's onwarn function #84

Pauan opened this issue Sep 26, 2016 · 0 comments

Comments

@Pauan
Copy link

Pauan commented Sep 26, 2016

With version 2.6.1 of rollup-plugin-babel I am getting these errors in the console:

The 'createClass' Babel helper is used more than once in your code. It's strongly recommended that you use the "external-helpers" plugin or the "es2015-rollup" preset. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information
The 'classCallCheck' Babel helper is used more than once in your code. It's strongly recommended that you use the "external-helpers" plugin or the "es2015-rollup" preset. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information

I have investigated the bundle and I know exactly why it is warning: I am importing a file in node_modules which has been pre-transpiled, so it is using ES6 modules but ES5 syntax, therefore it includes its own internal version of createClass and classCallCheck. From what I understand, this is exactly what package authors are supposed to do.

Ideally rollup-plugin-babel would be smart enough to figure out that this is okay, but in the meantime I would really like to silence these warnings.

So I tried defining an onwarn function in my rollup.config.js:

export default {
  onwarn: function (x) { console.log("test", x); }
};

This works fine for warnings generated by Rollup itself, but does not work for the warnings generated by rollup-plugin-babel (such as the above).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants