plugins icon indicating copy to clipboard operation
plugins copied to clipboard

Recommend consistent order for commonjs and node-resolve plugins

Open Krinkle opened this issue 6 months ago • 0 comments

  • Rollup Plugin Name: @rollup/commonjs, @rollup/node-resolve
  • Rollup Plugin Version: latest

Documentation Is: Confusing.

  • https://github.com/rollup/plugins/tree/node-resolve-v15.2.3/packages/node-resolve#using-with-rollupplugin-commonjs
  • https://github.com/rollup/plugins/tree/commonjs-v26.0.1/packages/commonjs#using-with-rollupplugin-node-resolve

Please Explain in Detail...

import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
…
plugins: [nodeResolve(), commonjs()]

Vs

import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
…
  plugins: [commonjs(), resolve()]

As an inexperienced user of Rollup, the difference is distracting and giving me reason to be uncertain, thinking that perhaps one of them is wrong or that I'll expose myself to some subtle bug if I do it wrong, or worse, that both are right for different use cases (hoping that's not the case!).

Your Proposal for Changes

If both behave the same, pick one and recommend it the same way in both. If one has issues, pick the other one. If both have merit, pick the same one to recommend by default in both packages, and document why/when to deviate.

Krinkle avatar Jul 28 '24 22:07 Krinkle