Prettier plugin not resolved when using GitHub package with pnpm, but works with npm
12:22 09 Mar 2025

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',
    '',
    '^@core/(.*)$',
    '^@server/(.*)$',
    '^@ui/(.*)$',
    '^[./]',
    '',
  ],
  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?

npm node-modules prettier pnpm github-packages