0

有谁知道如何让 Polymer 3 与 Visual Studio 一起运行?

我已经使用 polyserve 开发服务器完成了一个演示。但是,我无法在 Visual Studio 中使用相同的代码。我不认为这取决于托管环境。

我使用这些说明创建了一个聚合物元素: https ://www.polymer-project.org/3.0/start/first-element/intro

它按预期工作。当我将代码移动到 Visual Studio 时,我得到:

无法解析模块说明符“@polymer/polymer/polymer-element.js”

我注意到,当我运行 polyserve 时,我收到了 64 个对该页面的请求。当我在 Visual Studio 中执行此操作时,我得到 3 - 我的 html、webcomponents-loader.js 和 demo-element.js

4

1 回答 1

0

您使用的编辑器无关紧要。我只对 polymer-3.x 使用 VS Code。

在本地安装聚合物后,您可以使用聚合物 CLI创建元素。

  • 创建一个目录,您要在其中启动项目并cd在该目录内
  • 在此位置打开终端并键入以下聚合物 cli 命令
  • polymer init-> select polymer-3-element,这将创建您的 hello world 元素
  • polymer serve启动服务器。你可以查看你的元素http://localhost:8080
于 2018-09-01T19:37:21.427 回答