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

What's the differences between acorn build in rollup and real acorn? #3471

Closed
LongTengDao opened this issue Mar 30, 2020 · 6 comments
Closed

Comments

@LongTengDao
Copy link
Contributor

LongTengDao commented Mar 30, 2020

Feature Use Case

There are many plugins can't use with rollup, just because rollup's built-in acorn edition.

Feature Proposal

I want to know, what's the necessity to build acorn in rollup? Is it possible to leave it in dependenciess?

Now I use acornInjectPlugins: [ () => require('acorn').Parser ] to hack that, but I'm not sure, will it cause rollup bug?

@lukastaegert
Copy link
Member

It is possible but it was a huge pain and caused its own bunch of issues. The way those broken plugins work is that they require acorn by themselves. Which may give them the correct acorn instance, or it may not. This caused quite a few issues not only for Rollup but also for Webpack (there was one issue with >100 people chiming in that was not really resolved for a very long time). Moreover, it made it impossible for us to support plugins in the browser build. And both installation and startup time of Rollup is now faster.

The "fix" for these plugins is really simple and can be done via pull request by anyone. It is even linked in the release notes.

Basically it is putting this one-liner in the right place: acornjs/acorn#870 (comment)

The decision was to put pressure on the ecosystem so that these plugins are fixed at last and the aforementioned issues are resolved for good.

@lukastaegert
Copy link
Member

lukastaegert commented Mar 30, 2020

To answer the original question, there is NO difference. Rollup aims to always bundle the latest version of acorn.

@lukastaegert
Copy link
Member

Another point to add is that it would currently make Rollup unuseable in a Node 13+ ESM environment, at least as far as I tried.

@LongTengDao
Copy link
Contributor Author

I see. So rollup just bundle the latest version acorn inside to enhance cooperativity, no any other hack modify to acorn api to achieve rollup internal aim which original acorn can't do?

@lukastaegert
Copy link
Member

Exactly. It is completely unmodified except that it is hoisted into the remaining Rollup bundle.

@LongTengDao
Copy link
Contributor Author

OK, then there will be no problem!

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

3 participants