rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
502 stars 126 forks source link

Use new context functions, fix issue when resolveId returns an object #387

Closed lukastaegert closed 5 years ago

lukastaegert commented 5 years ago

This PR gets rid of a lot of special logic by using things built into (the current and an upcoming) version of Rollup. Mainly, rollup/rollup#2844 will add an option skipSelf to this.resolve which replaces the custom logic of this plugin with a more predictable one. Also this should provide a slight performance boost as we get rid of some unnecessary promises (the transform hook will be sync after this PR!).

Furthermore, this changes the format of plugin-generated proxy ids to \0./original/import/path?commonjs-proxy to allow for plugins like rollup-plugin-global-externals to more easily filter for those modules by just removing the leading \0.