1

我们正在开发一个发布到私人仓库的角度库。我们运行一个本地 Web 应用程序来测试开发中的库。我们也发布图书馆。

当我使用 构建应用程序ng build时,结果dist版本无法运行。

我的文件结构是:

./projects/my-library
./src

我的 CI 构建过程是:

npm ci
npm run build // Creates dist/my-library
ng build --base-href '/test' --configuration=test --output-path=./dist/test

我最终得到一个dist目录:

./dist/my-library
./dist/test

里面的index.html文件./dist/test

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Another App</title>
    <base href="/test" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" type="image/x-icon" href="favicon.ico" />
    <link rel="stylesheet" href="styles.2bf96ac9aaebbaa03e0c.css" />
  </head>

  <body>
    <app-root></app-root>
    <script type="text/javascript" src="runtime.17ac16aaa641f7087ac1.js"></script>
    <script type="text/javascript" src="polyfills.d1c7bf4a2ae7c3435f95.js"></script>
    <script type="text/javascript" src="main.08b6c456c92aa092bef8.js"></script>
  </body>
</html>

为了确保这有效,我正在运行http-server以测试我的应用程序:

http-server ./dist/test

这是我的问题。应用程序询问我是否忘记配置商店?我不明白,因为这只发生在我运行dist应用程序版本时。

这是错误:

ERROR Error: Uncaught (in promise): Error: Dispatch failed: did you forget to configure your store? https://github.com/angular-redux/@angular-redux/core/blob/master/README.md#quick-start
Error: Dispatch failed: did you forget to configure your store? https://github.com/angular-redux/@angular-redux/core/blob/master/README.md#quick-start
    at Object.e.assert (4.131ee1951f9b1e86a9da.js:1)
    at e.n.dispatch (4.131ee1951f9b1e86a9da.js:1)
    at new <anonymous> (4.131ee1951f9b1e86a9da.js:1)
    at main.08b6c456c92aa092bef8.js:1
    at Wd (main.08b6c456c92aa092bef8.js:1)
    at main.08b6c456c92aa092bef8.js:1
    at new t (main.08b6c456c92aa092bef8.js:1)
    at gh (main.08b6c456c92aa092bef8.js:1)
    at Object.Ay [as createNgModuleRef] (main.08b6c456c92aa092bef8.js:1)
    at e.create (main.08b6c456c92aa092bef8.js:1)
    at O (polyfills.d1c7bf4a2ae7c3435f95.js:1)
    at O (polyfills.d1c7bf4a2ae7c3435f95.js:1)
    at polyfills.d1c7bf4a2ae7c3435f95.js:1
    at e.invokeTask (polyfills.d1c7bf4a2ae7c3435f95.js:1)
    at Object.onInvokeTask (main.08b6c456c92aa092bef8.js:1)
    at e.invokeTask (polyfills.d1c7bf4a2ae7c3435f95.js:1)
    at t.runTask (polyfills.d1c7bf4a2ae7c3435f95.js:1)
    at v (polyfills.d1c7bf4a2ae7c3435f95.js:1)

这肯定是@angular-redux/store导致这个问题的原因。我删除了目录dist/my-library,我得到了同样的错误。Angular 能够使用本地库构建应用程序,但是本地库在 Redux 存储(即@angular-redux/store.

4

0 回答 0