在操场上添加NPM软件包nativescript-dev-webpack后,当我要保存项目时出现错误:
An error occurred while transpiling nativescript-dev-webpack/dependencyManager.js.
unknown: The keyword 'package' is reserved (105:51)
103 | }
104 |
> 105 | return packageJson.dependencies.hasOwnProperty(package) ||
| ^
106 | packageJson.devDependencies.hasOwnProperty(package);
107 | }
108 |
此后,我更改了nativescript-dev-webpack / dependencyManager.js文件,并在DependsOn函数中将其打包为pkg:
function dependsOn(packageJson, pkg) {
if (!packageJson) {
return false;
}
return packageJson.dependencies.hasOwnProperty(pkg) ||
packageJson.devDependencies.hasOwnProperty(pkg);
}
我还从nativescript-dev-webpack / lib / before-watch.js中删除了module.exports
然后我从nativescript-dev-webpack / snapshot / android / snapshot-generator.js SnapshotGenerator.prototype.runMksnapshotTool函数中删除了。
最后,我在nativescript-dev-webpack / snapshot / android / utils.js中进行了更改
这个:chmodSync(destinationFilePath, 0755)
到:chmodSync(destinationFilePath, 777)
之后,我可以保存和预览项目。我会因为编辑而使webpack出现问题吗?