Hamidreza
Hamidreza

Reputation: 1565

Prettier plugin not resolved when using GitHub package with pnpm, but works with npm

I’ve got a GitHub package for my Prettier config that I use across a bunch of my projects. The config uses a plugin, and when I install the package using pnpm, it puts the plugin inside the .pnpm folder in node_modules, but then Prettier throws an error saying it can’t find the plugin.

Weird thing is — when I install it with npm, everything works just fine.

Here’s what my Prettier config file looks like:

/**
 * @see https://prettier.io/docs/configuration
 * @type {import("prettier").Config}
 */
module.exports = {
  tabWidth: 4,
  semi: false,
  singleQuote: true,
  importOrder: [
    '^react|^react-dom',
    '<THIRD_PARTY_MODULES>',
    '^@core/(.*)$',
    '^@server/(.*)$',
    '^@ui/(.*)$',
    '^[./]',
    '<TYPES>',
  ],
  importOrderSortSpecifiers: true,
  importOrderMergeDuplicateImports: true,
  plugins: ['@ianvs/prettier-plugin-sort-imports'],
}

I’ve tried installing the plugin both as a dependency and a devDependency in the package, but no luck either way.

Any idea how to fix this?

Upvotes: 0

Views: 12

Answers (0)

Related Questions