Dart 的 .packages 文件和链接的解析

Dart's .packages file and resolution of links

在升级到 Dart 1 之前。12.x 版本以下 .html 文件链接正确解析。

.html

<!DOCTYPE html>
<link href='../../../../packages/core_elements/core_icon.html' rel='import'>
<link href='../../../../packages/html_components/utility/safe_html.html' rel='import'>

<polymer-element name='required-tooltip'>  
  <template>
      <div layout horizontal flex id='<tipp></tipp>'>
        <core-icon id='tip-icon' icon=''></core-icon>
        <h-safe-html id='label' content='<bol><u>Required</u><bold>'></h-safe-html>
      </div>
  </template>

  <script type='application/dart' src='required_tooltip.dart'></script>
</polymer-element>

第 2 行和第 3 行导入正确解析。

升级到新的 .packages 文件而不是 /package 符号链接后,none 个链接被解析。

纠正这些问题的新规则是什么?

谢谢

当您 运行 pub getpub upgrade 时,WebStorm 11 EAP 使用 --no-package-symlinks。此功能仍处于试验阶段。一个简单的解决方法是从命令行执行 运行 pub getpub upgrade,您将获得带有符号链接的 packages 目录。

当所有地方都支持使用 .packages 文件进行解析时,即使 packages 目录不再存在,您的代码中也不应该有任何必要的更改。

另见 https://github.com/dart-lang/sdk/issues/24237