我的项目工作得非常好..但是在进行git推送后,我在运行gulp
时突然收到错误:
{ [Error: ModuleParseError: Module parse failed:
/Users/xyz/project/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json
Line 1: Unexpected token :
You may need an appropriate loader to handle this file type.
| {"uChars":[128,16 ....
为什么会这样?我已经卸载并重新安装了此模块iconv-lite
,但它似乎没有帮助。
答案 0 :(得分:17)
我收到了同样的错误。您将要安装JSON加载程序模块。我在这个例子中使用json-loader。
module: {
loaders: [
{ test: /\.json$/, loader: "json-loader"}
]
}
然后,您需要将此加载程序添加到webpack.config.js
<md-dialog aria-label="Send Email">
<md-dialog-content>
<h3>Issue Details</h3>
<h4>Description</h4>
<md-input-container>
<label>Add description:</label>
<textarea class="form-control input-lg" style="width: 500px; height:100px;"></textarea>
</md-input-container>
<h3>Sub-tasks:</h3>
<md-list-item ng-repeat=" subtask in subtasks">
<p>{{subtask.content}}</p>
<md-checkbox aria-label="blarg" class="md-secondary" style="padding-right:60px;" ng-click="removeSubTask(subtask,$index)"></md-checkbox>
<md-list-item ng-if="addingTask === true"> <input ng-if="addingTask===true" ng-model="task.content" aria-label="blarg" placeholder="Add Subtask Here"></input>
</md-dialog-content>
<md-dialog-actions>
<md-button ng-show="addingTask === false" ng-click="addingSt()" class="btn btn-primary">
Add Sub-Task
</md-button>
<md-button ng-show="addingTask === true" ng-click="addingSt()" class="btn btn-primary">
cancel
</md-button>
<md-button ng-show="addingTask === true" ng-click="addSubTask()" class="btn btn-primary">
Submit
</md-button>
<md-button ng-click="closeDialog()" class="btn btn-primary">
Close
</md-button>
答案 1 :(得分:3)
我通过对node-fetch
的间接依赖来获得此依赖关系并通过将以下内容添加到我的webpack.config.js来修复此问题:
externals: {
'node-fetch': 'fetch'
}
答案 2 :(得分:-1)
删除文件解决了问题。