简体   繁体   English

了解 webpack.Configuration

[英]Understanding webpack.Configuration

import * as webpack from 'webpack';

... ...

transforms.webpackConfiguration = (config: webpack.Configuration) => {
    patchWebpackConfig(config, options);

While reading some code from an Angular project I stumbled over this code above.在从 Angular 项目中读取一些代码时,我偶然发现了上面的代码。 What I am curios about is the argument passed to the anonymus function: webpack.Configuration .我好奇的是传递给匿名 function: webpack.Configuration的参数。 After some research I couldn't find a documentation to this dataype and on my local machine I am not able to "step into" and look at the actual implementation.经过一些研究,我找不到该数据类型的文档,并且在我的本地机器上我无法“进入”并查看实际的实现。 If you have some information or useful links to this topic I would really appreciate it.如果您有关于该主题的一些信息或有用的链接,我将不胜感激。

cheers干杯

Just to be sure you know what you are looking at: the right hand side of the : in the arrow function argument is the TypeScript type annotation, so the function has only one argument ( config ), which is of the type webpack.Configuration . Just to be sure you know what you are looking at: the right hand side of the : in the arrow function argument is the TypeScript type annotation, so the function has only one argument ( config ), which is of the type webpack.Configuration .

The types for webpack are maintained in the package @types/webpack (state of July 2020). webpack 的类型在 package @types/webpack中维护(2020 年 7 月的状态)。 If you want to have a look at them, install them using npm install @types/webpack and open node_modules/@types/webpack/index.d.ts , you should find the interface Configuration there inside the namespace webpack .如果您想查看它们,请使用npm install @types/webpack安装它们并打开node_modules/@types/webpack/index.d.ts ,您应该在命名空间webpack中找到接口Configuration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM