本文介绍了更新后ember-cli 2.11.0版本如何以npm代替bower?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 ember-cli 更新为 2.11.0 时,我发现 EMBER NO LONGER SUPPLIED VIA Bower 。所以我检查npm而不是凉亭,但我不知道该怎么办。

When I updated ember-cli to 2.11.0 and I found EMBER NO LONGER SUPPLIED VIA bower. So I check npm instead of bower, but I don't know what to do.

moment.js 使用凉鞋看起来像:

bower.json

bower.json

"dependencies": {
  ...
  "moment": "2.14.1"
}

ember-cli-build.js

ember-cli-build.js

...
app.import('bower_components/moment/moment.js');
...

.jshintrc

.jshintrc

...
"moment": true,
...

这样可以在帮助控制器中运行。

但是我使用 npm 并设置 ember-cli-build.js 代码 app.import('node_modules / moment / moment.js'); 有错误。

But I use npm and set ember-cli-build.js code app.import('node_modules/moment/moment.js'); had errors.

css aslo有这个问题。

And cssaslo have this problem.

在ember-cli中,什么是npm而不是bower的最佳方法?谢谢。

What is best way to npm instead of bower in ember-cli? Thanks.

推荐答案


  1. 通过

npm install ember-browserify --save -dev

npm安装时刻--save-dev

您可以从

you can import it by import moment from 'npm:moment'


  1. 尝试

  2. ember包不通过 bower 提供。这并不意味着你根本不能使用凉亭。您仍然可以使用 bower.json ,并像您一样添加。

  3. 您可以在供应商文件夹,并包含它 ember-cli-build.js 文件。但是对于moment.js的包含。这不是正确的方式。

  1. Try ember-cli-moment-shim
  2. ember packages are not served through bower. It does not mean you can't use bower at all. You can still use bower.json and include it like you did.
  3. You can have it in vendor folder and include it ember-cli-build.js file . but for moment.js inclusion. this is not the right way.

我更喜欢1或2个选项。在这种情况下,3和4不适用。

I prefer 1 or 2 options. and 3 and 4 is not applicable in this case.

这篇关于更新后ember-cli 2.11.0版本如何以npm代替bower?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 12:23