非标准Dart Web文件夹

时间:2018-08-27 17:44:06

标签: dart

我是Dart的新手,我正在尝试创建一个新的Web项目。标准Web文件夹需要替换为名为“ webapps”的文件夹(因为它将与Java项目集成在一起)。不幸的是,当dart源失败时,我无法构建Dart Web项目。

build.yaml

targets:
  $default:
    sources:
      - webapp/**

    builders:
      build_web_compilers|entrypoint:
        generate_for:
          - webapp/**.dart 

webdev构建-v

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 328ms

[INFO] BuildDefinition:Checking for updates since last build...
[INFO] BuildDefinition:Checking for updates since last build completed, took 448ms

[INFO] Build:Running build...
[INFO] Build:Running build completed, took 203ms

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 126ms

[SEVERE] build_modules|modules on webapp/main.dart (cached):

NoSuchMethodError: The getter 'modules' was called on null.
Receiver: null
Tried calling: modules
dart:core                                                               Object.noSuchMethod
package:build_modules/src/module_builder.dart 54:37                     ModuleBuilder.build
package:build                                                           runBuilder
package:build_runner_core/src/generate/build_impl.dart 454:17           _SingleBuild._runForInput.<fn>.<fn>
package:build_runner_core/src/generate/performance_tracker.dart 314:73  _NoOpBuilderActionTracker.track
package:build_runner_core/src/generate/build_impl.dart 453:21           _SingleBuild._runForInput.<fn>
dart:async                                                              new Future.sync
package:pool/pool.dart 126:18                                           Pool.withResource.<fn>

[SEVERE] build_web_compilers|entrypoint on webapp/main.dart (cached):

AssetNotFoundException: Dart_Test|webapp/main.module
package:build_web_compilers/src/dart2js_bootstrap.dart 29:21            bootstrapDart2Js
package:build_web_compilers/src/web_entrypoint_builder.dart 123:13      WebEntrypointBuilder.build
package:build                                                           runBuilder
package:build_runner_core/src/generate/build_impl.dart 454:17           _SingleBuild._runForInput.<fn>.<fn>
package:build_runner_core/src/generate/performance_tracker.dart 314:73  _NoOpBuilderActionTracker.track
package:build_runner_core/src/generate/build_impl.dart 453:21           _SingleBuild._runForInput.<fn>
dart:async                                                              new Future.sync
package:pool/pool.dart 126:18                                           Pool.withResource.<fn>

[SEVERE] Build:
Failed after 371ms

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您还需要在默认目标中将lib下的所有文件包括在内(即使您没有任何文件,它也包含神奇的lib/$lib$占位符):

targets:
  $default:
    sources:
      - lib/**
      - webapp/**
    builders:
      build_web_compilers|entrypoint:
        generate_for:
          - webapp/**.dart