Closed juliendargelos closed 4 years ago
Thanks for the PR and I see your point, but instead of renaming the export, how about adding
export default resolveTypescriptPaths;
so that you can import it as
import typescriptPaths from 'rollup-plugin-typescript-paths';
?
Because otherwise this is a breaking change, and a general naming convention is that functions should start with a verb in their name. I probably should have called the repo rollup-plugin-resolve-typescript-paths
but that's such a long name 🤓
Hm just trying this out and simply adding export default
works for es modules and typescript, but it's not a commonjs default export and therefore would need to be required as require('rollup-plugin-typescript-paths').default
. To create a cjs default export, the syntax would be export =
, but then the module can't have any other (named) exports. What official rollup plugins do is to use rollup to bundle the plugin into both a cjs and an es module but I can't be bothered.
I published it to npm as 1.2.1
. I added
export const resolveTypescriptPaths = typescriptPaths;
export default typescriptPaths;
so that it doesn't break the previous named import and it's also possible to use the default import sytnax.
Almost every rollup plugin exports a function whose name is a camel-cased version of the package name without the
rollup-plugin-
(or@rollup/plugin-
) prefix. Since rollup-plugin-typescript-paths uses a named export, I cannot rename it without using theas
keyword, and it kind of stands out among the other plugins:I know this pr is quite incidental, but would you consider it ?