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

Not working as an output plugin (warnings printed) #858

Closed
stevage opened this issue Apr 15, 2021 · 4 comments
Closed

Not working as an output plugin (warnings printed) #858

stevage opened this issue Apr 15, 2021 · 4 comments

Comments

@stevage
Copy link

stevage commented Apr 15, 2021

  • Rollup Plugin Name: @rollup/plugin-babel
  • Rollup Plugin Version:5.3.0
  • Rollup Version:2.45.1
  • Operating System (or Browser): MacOS
  • Node Version:14.15.4
  • Link to reproduction (⚠️ read below): https://replit.com/@stevage/rollup-plugin-repro

Expected Behavior

Able to specify babel for certain outputs but not all.

Actual Behavior

Many warnings printed:

(!) The "buildStart" hook used by the output plugin commonjs is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "load" hook used by the output plugin commonjs is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "moduleParsed" hook used by the output plugin commonjs is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "resolveId" hook used by the output plugin commonjs is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "transform" hook used by the output plugin commonjs is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "load" hook used by the output plugin babel is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "options" hook used by the output plugin babel is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "resolveId" hook used by the output plugin babel is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
(!) The "transform" hook used by the output plugin babel is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.

Additional Information

I'm actually pretty new to this stuff, so this could well be user error. However, my understanding was this was supposed to work as of v5: #360

My actual project (from which the minimal repro is derived) is here. My goal (possibly misguided) was to provided a non-babel ES5 version of the library for modern consumers, and a legacy UMD+babel version for use in script tags, and in Node (for testing with Jest).

I did note this advice:

When using @rollup/plugin-babel with @rollup/plugin-commonjs in the same Rollup configuration, it's important to note that @rollup/plugin-commonjs must be placed before this plugin in the plugins array for the two to work together properly. e.g.

But I didn't know how to make that work in the case where commonjs is applied for all inputs, but babel is not.

@stevage stevage changed the title hook used by the output plugin babel is a build time hook and will not be run for that plugin Not working as an output plugin (warnings printed) Apr 15, 2021
@shellscape
Copy link
Collaborator

Please see https://www.rollupjs.org/guide/en/#using-output-plugins. Neither plugin is intended to be used as an output plugin.

@stevage
Copy link
Author

stevage commented Apr 15, 2021

Thank you. This was the issue I meant to link to above, and the related PR. They certainly give the impression it was meant to work.

Are you saying that it's not possible to generate two outputs from the same input, one that runs through Babel and one that doesn't?

@stevage
Copy link
Author

stevage commented Apr 15, 2021

I see there is a getBabelOutputPlugin method, which seems to behave quite differently.

I guess ideally, the warning in the first place might say something like

(!) babel() is not an output plugin. You might be looking for getBabelOutputPlugin() instead. See https://github.com/rollup/plugins/tree/master/packages/babel

@shellscape
Copy link
Collaborator

Thanks for confirming. It might be worth submitting a modification request to the main rollup project (rollup/rollup).

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

No branches or pull requests

2 participants