ソースを参照

fix(graphiql-plugin): Fix asset path for pnpm

pnpm does not serve the static files unless we use the "root" option.
Same issue as discussed in #3499
Michael Bromley 8 ヶ月 前
コミット
882a055ef7
1 ファイル変更1 行追加1 行削除
  1. 1 1
      packages/graphiql-plugin/src/plugin.ts

+ 1 - 1
packages/graphiql-plugin/src/plugin.ts

@@ -165,7 +165,7 @@ export class GraphiqlPlugin implements NestModule {
                 const filePath = path.join(distDir, 'assets', assetPath.toString());
 
                 if (fs.existsSync(filePath)) {
-                    return res.sendFile(filePath);
+                    return res.sendFile(assetPath.toString(), { root: path.join(distDir, 'assets') });
                 } else {
                     return res.status(404).send('Asset not found');
                 }