如何让SAP Spartacus ng build生成的JavaScript资源附带上store ID

问题

As we are migrating our storefront to Spartacus, we can see the following JS resources generated do not contain the store id and this is causing issues with out cdn as we have multiple origin servers where to route the requests for this JS files.

  • /runtime-es2015.js
  • /polyfills-es2015.js
  • /styles-es2015.js
  • /vendor-es2015.js
  • /main-es2015.js

期望的行为

  • /uk/runtime-es2015.js
  • /uk/polyfills-es2015.js
  • /uk/styles-es2015.js
  • /uk/vendor-es2015.js
  • /uk/main-es2015.js

解决方案

参考这个*帖子:What’s the difference between --base-href and --deploy-url parameters of angular-cli tool

使用如下命令行:

ng build --deploy-url /uk/

上一篇:【早读汇】广州@mogeWCY的《实战ES2015》笔记


下一篇:ES2015+学习笔记系列(八)—— 数值、对象扩展