Adding a module dependency in Aurelia with Webpack

落爺英雄遲暮 提交于 2019-12-13 16:18:43

问题


I'm just getting started with the Aurelia Webpack Skeleton and trying to simply add a new dependency. Suppose I want to use moment.js in my application. What are the expected steps to download and use the module in my application?

EDIT: I see that moment.js is already loaded by default. So suppose it's numeral.js I want to use as an example.


回答1:


Install the library via npm using a console, pointing to the application folder:

npm install numeral --save

Now, you just have to import it in your js file:

import numeral from 'numeral';


来源:https://stackoverflow.com/questions/36579305/adding-a-module-dependency-in-aurelia-with-webpack

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