加载模块时出现意外警告

时间:2016-08-25 14:05:45

标签: npm webpack

我使用名称为" jwerty"的npm模块。它工作正常,但在控制台中我有很多警告,如下所示。我使用webpack @ 1和npm @ 3。

WARNING in ./~/jwerty/component.json
Module parse failed: /node_modules/jwerty/component.json Line 2: Unexpected      token :
You may need an appropriate loader to handle this file type.
| {
|   "name": "jwerty",
|   "version": "0.3.2",
|     "description": "Awesome handling of keyboard events",
 @ ./~/jwerty ^\.\/.*$

WARNING in ./~/jwerty/jwerty.canBridge.js
Module parse failed: node_modules/jwerty/jwerty.canBridge.js Line 1: Unexpected token function
You may need an appropriate loader to handle this file type.
| steal('can/control/modifier', './jwerty.js' function(Control){
|
| /**
 @ ./~/jwerty ^\.\/.*$

我相信npm会直接进入"进入"指向package.json,因此只有在此"条目"中没有其他import或require语句时才会加载此文件。文件。我没有找到它们,但webpack告诉我这些警告。

我怎样才能摆脱它们?我拥有它们的原因是什么?

1 个答案:

答案 0 :(得分:0)

问题出在文件内的require内。库试图检查是否存在'jquery','zepto'等,因此webpack尝试加载并解析index.js附近的文件并发出警告。

相关问题