Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.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
如何使用Angular appShell build添加子资源完整性_Build_Server Side Rendering_App Shell_Angular Cli V9 - Fatal编程技术网

如何使用Angular appShell build添加子资源完整性

如何使用Angular appShell build添加子资源完整性,build,server-side-rendering,app-shell,angular-cli-v9,Build,Server Side Rendering,App Shell,Angular Cli V9,我用Angular CLI 9构建了一个应用程序。 我用以下代码修补了package.json文件: { "scripts": { "build:prod": "ng build --prod --subresource-integrity", "prebuild:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node ./sitemap_generator.ts" } } 所以,当我调

我用Angular CLI 9构建了一个应用程序。 我用以下代码修补了
package.json
文件:

{
  "scripts": {
    "build:prod": "ng build --prod --subresource-integrity",
    "prebuild:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node ./sitemap_generator.ts"
  }
}
所以,当我调用
npm run build:prod
时,我的两个命令被执行,编译器生成的输出文件包含SRI

现在,我添加了appShell:

npm运行ng生成appShell---客户端项目我的项目

要使用appShell运行构建,我必须使用以下命令:

npm run ng run my project:app shell:production

主要问题

但是这个命令调用
myproject:build:production
configuration of
angular.json
文件,这不接受
--subresource integrity
参数:/

如何修补此漏洞以使用SRI构建appShell产品

勇士队的第二个问题

此appShell构建在
dist/
中创建一个
server/
文件夹。它只包含一个
main.js
文件。我想它在内部与Node一起使用来构建appShell;有人能证实吗? 那么,我可以使用Unversal也和这个架构一起为搜索引擎做一些SSR吗


谢谢

好的,我通过编辑angular.json找到了一种方法:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "my-project",
  "projects": {
    "oce-training": {
      "architect": {
        "build": {
          "configurations": {
            "production": {
              "subresourceIntegrity": true,
            }
          }
        }
      }
    }
  }
}
因此,我们不能在
package.json上重写,也不能通过CLI命令重写,但这对于我的情况已经足够了

现在我在
package.json中看到了:

{
  "scripts": {
    "build:prod": "ng run oce-training:app-shell:production",
    "prebuild:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node ./sitemap_generator.ts"
  },
}
我关于SSR的问题仍然存在,但这可能是另一个Stackoverflow帖子;)