首页 > 解决方案 > 如何在 Angular Dart 项目中提供多个不同的目录?

问题描述

我正在尝试在我的 Angular Dart 项目中设置几个配置,以便可以从几个不同的顶级目录(标准web目录除外)提供和构建不同版本的 Angular 应用程序。为了演示,我创建了标准 Angular Dart来自模板(https://github.com/vadimtsushko/two_configs_test)的应用程序,并将web目录复制到web2. 我可以web使用pub run build_runner serve web:8080. 现在我添加build.web2.yaml具有此类内容的配置文件:

targets:
  $default:
    builders:
      build_web_compilers|entrypoint:
        # These are globs for the entrypoints you want to compile.
        generate_for:
          - web2/**.dart

之后,我运行这个新web2配置,希望能够web2使用这样的命令从目录中为应用程序提供服务: pub run build_runner serve --config=web2 web2:8080 但我收到一个警告:

[WARNING] Requested a server for `web2` but this directory has no assets in the build. You may need to add some sources or include this directory in some target in your `build.yaml`
Serving `web2` on http://localhost:8080

我在目录中肯定有源文件( main.dart) 。web2我已经包含web2在一个目标中,build.web2.yaml但显然该配置文件有问题。

我应该在我的build.web2.yaml文件中进行哪些更改才能使其正常工作?

标签: dartangular-dart

解决方案


推荐阅读