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

It should be clarified that plugin-commonjs should be placed before plugin-babel #620

Closed
1 of 4 tasks
shrinktofit opened this issue Oct 24, 2020 · 2 comments
Closed
1 of 4 tasks

Comments

@shrinktofit
Copy link

shrinktofit commented Oct 24, 2020

  • Rollup Plugin Name: plugin-commonjs/plugin-babel
  • Rollup Plugin Version: latest

Documentation Is:

  • Missing
  • Needed
  • Confusing
  • Not Sure?

Please Explain in Detail...

Since how @rollup/plugin-commonjs and @rollup/plugin-babel are implemented. It's better to hint user that when specify rollup plugins, they'd better place @rollup/plugin-commonjs before @rollup/plugin-babel.

Reason

Given a module in CommonJS format and its code needs to be processed by babel. For example:

module.exports = typeof window;

@rollup/plugin-babel will inject helper codes:

import { typeof as _typeof } from "\0rollupPluginBabelHelpers.js";
module.exports = (typeof window === "undefined" ? "undefined" : _typeof(window));

then, the transformed source will be passed to @rollup/plugin-commonjs. The CommonJS plugin then treat the source as ES6 module(because of the import syntax @rollup/plugin-babel inserted) and does not process further and leads to *** is not exported by ***.

Your Proposal for Changes

Document the order issue in plugin section.

@shellscape
Copy link
Collaborator

If you are sure this is a bug or documentation issue, please take the time to refile this issue using the issue template.

Hey there, thanks for opening an issue - Unfortunately you missed (or may have disregarded) the message about issue templates being required. Because our issue template was removed, we assume that this is a support request, and that's not something we offer here. Also, if you refile, please don't ignore Issue sections. They're in the template because they're useful to the maintainers of this project.

@shrinktofit
Copy link
Author

@shellscape I have now refiled the issue in #622

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