【发布时间】:2018-09-16 17:51:41
【问题描述】:
我的node_modules 目录中有一个节点模块。但是,我不知道如何使用它。结构如下:
node_modules
|- ...
|- foo-bar
| |- dist
| | |- css
| | - css files here
| | |- js
| | - js files here
| | |- foo-images
| | - image files here
| | |- index.js
| |- index.js
| |- package.json
|- ...
index.js 里面有这个:
require('./dist/js/foo');
module.exports = 'foo';
所以我的问题是如何使用它?在我的app.component.ts 中,我尝试将以下代码放在顶部:
import { foo } from './foo-bar';
但是foo 上的大括号之间有一个错误,表示它不知道那是什么。当我尝试require('foo') 时,我收到一条错误消息,说它不知道require 是什么(我安装了Express)。
如何使用节点模块中的 CSS 和 JavaScript 函数?我是 Angular 5 的新手,所以我并不完全熟悉它的工作原理。任何帮助将不胜感激,谢谢!
【问题讨论】:
标签: node.js angular webstorm angular5 node-modules