Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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
Dart 找不到资产_Dart_Angular Dart - Fatal编程技术网

Dart 找不到资产

Dart 找不到资产,dart,angular-dart,Dart,Angular Dart,我以这种方式链接example/index.html中的js文件: <script src="../lib/src/myjsfile.js"></script> pub serve example 我进了CLI: [示例]GET lib/src/myjsfile.js=>找不到资产mod|u lib | example/lib/src/myjsfile.js 它在示例目录中查找资产并忽略部分“./”。 如何修复此问题?请改用包路径 <script src="pa

我以这种方式链接example/index.html中的js文件:

<script src="../lib/src/myjsfile.js"></script>
pub serve example
我进了CLI:

[示例]GET lib/src/myjsfile.js=>找不到资产mod|u lib | example/lib/src/myjsfile.js

它在示例目录中查找资产并忽略部分“./”。
如何修复此问题?

请改用包路径

<script src="packages/mod_lib/src/myjsfile.js"></script>

lib/
目录内导入文件的
lib/
目录外的每个文件都需要使用包导入。
dart2js
还识别上述形式的包导入,并用生成输出目录中的实际路径替换它们

我创造

packages
是早期Dart版本中的真实目录,其中包含指向
。/lib
(以及
pubspec.yaml
中指定的所有其他依赖项)的符号链接。不久前,它被
.packages
文件的内容所取代。您将在
~/.pub cache
中找到当前软件包名称的一个条目,该条目包含指向
lib
目录的路径(以及
pubspec.yaml
中的所有依赖项,以及指向下载目录的路径)

请您试试
它可以解决问题。但是:1)没有任何“包”目录2)文档中没有发现它