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

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

@Pauan

Description

@Pauan

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions