我想在React中为process
对象添加一个属性,所以Webpack
将用DefinePlugin
插件替换它:
declare global {
interface Process {
gitInfo: {
GIT_COMMIT_DATE?: string;
GIT_COMMIT_HASH?: string;
GIT_BRANCH?: string;
GIT_COMMIT_MESSAGE?: string;
};
}
}
const gitInfo = process.gitInfo; // Error: Property 'gitInfo' does not exist on type 'Process'.ts(2339)
有什么问题吗?