【发布时间】:2017-04-14 13:37:31
【问题描述】:
我想在我的 Typescript Aurelia 应用程序中使用下划线。 我在其中创建了一个打字稿文件:
import * as _ from 'underscore'
但是 VS Code 说:
[ts] 找不到模块“下划线”
我已经把这个放到 webpack.config 中了:
plugins:[
new webpack.ProvidePlugin({
underscore:'underscore'
})
]
我也安装了下划线:
npm install --save underscore
我还需要做什么才能让它工作?
【问题讨论】:
-
这里有一个错字:
npm install --save undersocre。你复制/粘贴了吗?还是你把错字只写在这里? -
我在这里写这行时的错字。
-
你不应该需要提供插件,因为你已经用 npm 安装了它。 webpack 会自动将下划线捆绑到你的主 javascript 包中,你的 javascript 文件将运行良好。但是这不应该影响打字稿
标签: typescript webpack visual-studio-code aurelia