使用Webpack在Aurelia中添加模块依赖项 [英] Adding a module dependency in Aurelia with Webpack

查看:105
本文介绍了使用Webpack在Aurelia中添加模块依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 Aurelia Webpack骨架并尝试简单地添加一个新的依赖项.假设我想在应用程序中使用moment.js.在我的应用程序中下载和使用该模块的预期步骤是什么?

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?

我看到默认情况下已经加载了moment.js.因此,假设我要使用numerical.js作为示例.

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

推荐答案

使用控制台通过npm安装库,指向应用程序文件夹:

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

npm install numeral --save

现在,您只需要将其导入到js文件中即可:

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

import numeral from 'numeral';

这篇关于使用Webpack在Aurelia中添加模块依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆