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

chore: add rollup plugins section #49

Merged
merged 3 commits into from
Jan 8, 2021
Merged

chore: add rollup plugins section #49

merged 3 commits into from
Jan 8, 2021

Conversation

patak-dev
Copy link
Member

General

✏️ Mark the necessary items without changing the structure of the PR template.

  • Pull request template structure not broken

Type

ℹ️ What types of changes does your code introduce?

👉 Put an x in the boxes that apply

  • Fix
  • Feature

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

👉 Put an x in the boxes that apply.

  • Title as described
  • Make sure you put things in the right category!
  • Always add your items to the end of a list

@patak-dev
Copy link
Member Author

I think we could add 5 or 6 more from the rollup official plugins
But there are tons at https://github.com/rollup/awesome that could be added. So I do not know if it is indeed a good idea to add this list. Ideally, this should be a badge in the repo of the plugins.

A possible option is to add the section and if it gets too large, separate it to a different list linked from this one. Or directly start from a separate list.

@yyx990803
Copy link
Member

Listing all the compatible ones from the official Rollup plugins repo would be good enough, I think. It would so be helpful to me if someone goes through that list to see if there are plugins that should work but don't.

@patak-dev
Copy link
Member Author

I am going through the official plugins list. I'll report if I find a bug.
We could list the official ones here and add a Community subsection that links to the awesome-rollup list + a link to the vote docs: https://vitejs.dev/guide/api-plugin.html#rollup-plugin-compatiblity so users know what to expect (and advocate later for Vite compatible and WMR compatible badges in that list, or in the individual repos)

@antfu
Copy link
Member

antfu commented Jan 8, 2021

That's great, I like the "Official already included in Vite" part! Thanks

@antfu antfu merged commit a8250c8 into vitejs:master Jan 8, 2021
- [@rollup/plugin-commonjs](https://github.com/rollup/plugins/blob/master/packages/commonjs) - Convert CommonJS modules to ES6
- [@rollup/plugin-dynamic-import-vars](https://github.com/rollup/plugins/blob/master/packages/dynamic-import-vars) - Resolving dynamic imports that contain variables.
- [@rollup/plugin-json](https://github.com/rollup/plugins/blob/master/packages/json) - Convert .json files to ES6 modules
- [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/blob/master/packages/node-resolve) - Locate and bundle third-party dependencies in node_modules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vite actually uses a custom resolver because plugin-node-resolve is too slow.

- [@rollup/plugin-dynamic-import-vars](https://github.com/rollup/plugins/blob/master/packages/dynamic-import-vars) - Resolving dynamic imports that contain variables.
- [@rollup/plugin-json](https://github.com/rollup/plugins/blob/master/packages/json) - Convert .json files to ES6 modules
- [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/blob/master/packages/node-resolve) - Locate and bundle third-party dependencies in node_modules
- [@rollup/plugin-typescript](https://github.com/rollup/plugins/blob/master/packages/typescript) - Integration between Rollup and Typescript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default TypeScript is handled with a custom esbuild plugin and the typescript plugin is only used for bundling Vite itself.

In some cases users may want to disable the esbuild transform and use proper tsc instead (e.g. if they want decorators or latest ts features etc.) - I'm not sure if @rollup/plugin-typescript would just work yet, will need to find out (it likely doesn't)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification, I will remove these two entries for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Evan, I included the ones that were in Vite's package.json, I should have dug deeper.

I was thinking about @rollup/plugin-image, from the docs looks like Vite supports importing images but it is not doing so by using this plugin. Should we include a section like: "Official plugins, with equivalent features in Vite" to list plugin-image, plugin-typescript, and plugin-node-resolve (and other similar cases)?
At least for me, it would be helpful to know that the features of these plugins are already covered (we can also link to the Vite docs for them)

antfu added a commit that referenced this pull request Jan 8, 2021
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

Successfully merging this pull request may close these issues.

3 participants