Skip to content

Conversation

AlCalzone
Copy link

While migrating a project that depends on ts-pegjs to ESM, I ran into a runtime error related to the Prettier TS plugin.

In
https://github.com/prettier/prettier/blob/6b582a061992ee614631b0ff196d92faad86c6c3/src/plugins/typescript.js#L1
the plugin is exported as a named export parsers.

This is accessed later in
https://github.com/prettier/prettier/blob/6b582a061992ee614631b0ff196d92faad86c6c3/src/plugins/builtin-plugins-proxy.js#L34
which expects to be able to access the parsers property of the plugin

By importing the plugin with * as ..., an additional wrapper object is added, resulting in prettierPluginTypescript to have the shape

{ default: { parsers: { typescript: [Object] } } }

instead of the expected

{ parsers: { typescript: [Object] } }

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