Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.warn and this.error are not available in transformBundle #1282

Closed
Pauan opened this issue Jan 24, 2017 · 5 comments
Closed

this.warn and this.error are not available in transformBundle #1282

Pauan opened this issue Jan 24, 2017 · 5 comments

Comments

@Pauan
Copy link
Contributor

Pauan commented Jan 24, 2017

Here is an example Rollup config:

export default {
  entry: "foo.js",
  format: "es",
  plugins: [
    {
      transformBundle: function (source) {
        console.log(this.warn);
        console.log(this.error);
      }
    }
  ]
};

And here is foo.js:

console.log(1);

Both this.warn and this.error are undefined, but they should be defined.

@olsonpm
Copy link
Contributor

olsonpm commented Jan 24, 2017

per the wiki

Inside a transform function, you can use this.warn(warning[, pos]) to provide feedback in a standard form.

transformBundle doesn't have a note about this.warn

@Pauan
Copy link
Contributor Author

Pauan commented Jan 24, 2017

@olsonpm I am aware. I am requesting that it be added to transformBundle as well.

@olsonpm
Copy link
Contributor

olsonpm commented Jan 24, 2017

Ah I misunderstood

@olsonpm
Copy link
Contributor

olsonpm commented Jan 27, 2017

Btw - I just came across this issue in my plugin (wanted this.warn inside the resolveId function). I looked at the warn code in rollup and it's very coupled to the transform function. Because of that, the quickest solution is to just provide your own onwarn plugin option.

It's a workaround, not a solution - but it worksaround well enough for me

@guybedford
Copy link
Contributor

These are now available for plugins in #2208.

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

No branches or pull requests

4 participants