Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用静态站点生成器(Gatsby)和Microsoft Graph Toolkit生成错误_Gatsby_Microsoft Graph Toolkit - Fatal编程技术网

使用静态站点生成器(Gatsby)和Microsoft Graph Toolkit生成错误

使用静态站点生成器(Gatsby)和Microsoft Graph Toolkit生成错误,gatsby,microsoft-graph-toolkit,Gatsby,Microsoft Graph Toolkit,我试图在静态站点生成器(Gatsby)中使用Microsoft Graph Toolkit,但在服务器端构建时遇到了错误。原始错误出现在: const policy=window.trustedTypes 在lit html包中。我可以使用gatsby-node.js中的onCreateWebpackConfig删除此项。如果我这样做了,a将在lit元素上获取下一个错误。最终,我使用以下gatsby-node.js删除了microsoft: exports.onCreateWebpackConf

我试图在静态站点生成器(Gatsby)中使用Microsoft Graph Toolkit,但在服务器端构建时遇到了错误。原始错误出现在:

const policy=window.trustedTypes

lit html
包中。我可以使用gatsby-node.js中的
onCreateWebpackConfig
删除此项。如果我这样做了,a将在
lit元素上获取下一个错误。最终,我使用以下gatsby-node.js删除了
microsoft

exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
    if (stage === "build-html") {
      actions.setWebpackConfig({
        module: {
          rules: [
            {
                test: /lit-html/,
                use: loaders.null(),
            },
            {
                test: /lit-element/,
                use: loaders.null(),
            },
            {
                test: /microsoft/,
                use: loaders.null(),
            },
          ],
        },
      })
    }
  }
不幸的是,现在我只能忍受:

failed Building static HTML for pages - 3.769s
error Building static HTML failed for path "/404/"


  Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and 
  additional helpful warnings.

  - react-dom-server.node.production.min.js:48 a.b.render
    [ComplianceForms-Web]/[react-dom]/cjs/react-dom-server.node.production.min.js:48:37
顺便说一下,我没有使用
React.lazy
suspend


我正在使用,并且有一个最小的修改。为了完整性,我使用了一个更简单的启动程序进行了测试,得到了相同的结果。

我认为您在
@microsoft/mgt react
包中添加了一个
null
加载程序。因此:


请注意,测试规则是一个正则表达式,因此该值必须与
节点\u模块
中的文件夹名称相匹配,这就是为什么您应该在
/mgt react
中转义斜杠的原因。不,这不起作用,现在我得到了:为页面构建静态HTML失败-5.306s错误构建静态HTML失败>47 |导出类MgtBaseComponent扩展LitElement{^48 |构造函数(){49 | super();50 |/**WebPackageError:TypeError:未定义的类扩展值不是构造函数或null
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
    if (stage === "build-html") {
      actions.setWebpackConfig({
        module: {
          rules: [
            {
                test: /@microsoft\/mgt-react/,
                use: loaders.null(),
            },
          ],
        },
      })
    }
  }