Skip to content

Fix options.extensions being modified by the plugin#36

Open
Sidnioulz wants to merge 1 commit into
aMarCruz:masterfrom
Sidnioulz:master
Open

Fix options.extensions being modified by the plugin#36
Sidnioulz wants to merge 1 commit into
aMarCruz:masterfrom
Sidnioulz:master

Conversation

@Sidnioulz

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

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

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.

1 participant