diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..dc17e961 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,36 @@ +declare module 'extract-css-chunks-webpack-plugin' { + import { ChunkData, Loader, Plugin } from 'webpack'; + + class ExtractCssChunksPlugin extends Plugin { + static loader: Loader; + + constructor(options?: ExtractCssChunksPlugin.PluginOptions); + } + + namespace ExtractCssChunksPlugin { + interface PluginOptions { + /** + * The filename of the entry chunk. + */ + filename?: string; + /** + * The filename of non-entry chunks. + */ + chunkFilename?: string; + /** + * Generates a file name (or template) based on chunk data. + */ + moduleFilename?: (chunk: ChunkData) => string; + /** + * Remove warnings about conflicting order. + */ + ignoreOrder?: boolean; + /** + * Inserts `` at the given position (https://github.com/faceyspacey/extract-css-chunks-webpack-pluginn#insert). + */ + insert?: string | Function; + } + } + + export = ExtractCssChunksPlugin; +} diff --git a/package.json b/package.json index a438e2ac..57f23914 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "extract-css-chunks-webpack-plugin" ], "main": "dist/cjs.js", + "types": "index.d.ts", "engines": { "node": ">= 6.9.0" }, @@ -59,7 +60,8 @@ "travis": "npm run ci:coverage" }, "files": [ - "dist" + "dist", + "index.d.ts" ], "peerDependencies": { "webpack": "^4.4.0 || ^5.0.0"