After update ember-cli 2.11.0 version how to npm instead of bower?

点点圈 提交于 2019-12-24 08:09:06

问题


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.

Such as moment.js use bower look like:

bower.json

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

ember-cli-build.js

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

.jshintrc

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

This way can run in help and controller.

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

And cssaslo have this problem.

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


回答1:


  1. Through ember-browserify

    npm install ember-browserify --save-dev
    npm install moment --save-dev

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

  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.

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



来源:https://stackoverflow.com/questions/42083398/after-update-ember-cli-2-11-0-version-how-to-npm-instead-of-bower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!