我需要对某些打字稿定义文件进行一些修改。到目前为止,我一直在手动进行这些修改 - 如果我删除node_modules目录并重新开始,或者如果我在新机器上安装我的代码,则会有点痛苦。但是这些改变只是很小而且很有效。但是现在我想使用一个调用npm install作为构建过程的一部分的服务来构建我的代码 - 当然,我的修改对于此过程是未知的。我包括我有下面进行修改的一个:手稿定义修改
Add the following:
adapter(param1: string, param2: any): Static;
After the first line in node_modules\@types\pouchdb-core\index.d.ts in the following Interface:
interface Static extends EventEmitter
In order to avoid an error with the following statement in data-service.ts:
PouchDB.adapter('writableStream', replicationStream.adapters.writableStream);
我的问题是如何使这种类型的修改我node_modules目录以外的,使外部构建过程会了解必要的修改。
我正在使用使用Webpack的Ionic 2。
看你怎么导入你要修改的模块,这将是有益的。 –
@JamesMonger我为PouchDB使用了一个简单的导入语句:从'pouchdb'导入PouchDB; – daveywc
对于我的一个项目,我在我的package.json中添加了一个“postinstall”步骤,该步骤运行bash脚本进行修改。这样做的正确方法可能是分叉回购。 –