rollup-plugin-cleanup icon indicating copy to clipboard operation
rollup-plugin-cleanup copied to clipboard

Fix options.extensions being modified by the plugin

Open Sidnioulz opened this issue 4 years ago • 1 comments

Hi,

Your plugin modifies the extensions object passed to its options, which means it cannot be reused across plugins. This means the following sample config fails to properly resolve imports:

const cleanup = require('rollup-plugin-cleanup')
const resolve = require('@rollup/plugin-node-resolve').default

const extensions = ['.js', '.jsx', '.ts', '.tsx', '.json', '.md', '.mdx']

module.exports = {
	// ...
	plugins: [
		resolve({ extensions }),
		cleanup({ extensions }),
	],
}

The following PR will ensure extensions are copied instead of written over. It allows Rollup users to share an extension list across plugins.

Sidnioulz avatar Jan 13 '22 17:01 Sidnioulz

I don't know what's up with the build bot. The yarn build and yarn test commands both succeed locally.

Sidnioulz avatar Jan 13 '22 17:01 Sidnioulz