瀏覽代碼

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());
                 const filePath = path.join(distDir, 'assets', assetPath.toString());
 
 
                 if (fs.existsSync(filePath)) {
                 if (fs.existsSync(filePath)) {
-                    return res.sendFile(filePath);
+                    return res.sendFile(assetPath.toString(), { root: path.join(distDir, 'assets') });
                 } else {
                 } else {
                     return res.status(404).send('Asset not found');
                     return res.status(404).send('Asset not found');
                 }
                 }