@types/webpack-concat-plugin
Version:
TypeScript definitions for webpack-concat-plugin
90 lines (81 loc) • 3.15 kB
Markdown
# Installation
> `npm install --save @types/webpack-concat-plugin`
# Summary
This package contains type definitions for webpack-concat-plugin (https://github.com/hxlniada/webpack-concat-plugin).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webpack-concat-plugin.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webpack-concat-plugin/index.d.ts)
````ts
import webpack = require("webpack");
import { MinifyOptions } from "uglify-js";
import { Compiler, Plugin } from "webpack";
/**
* A plugin to help webpack concat js and inject into html
*/
declare class ConcatPlugin extends Plugin {
constructor(options?: ConcatPlugin.Options);
ensureTrailingSlash(str: string): string;
getFileName(file: string | { [file: string]: string }, filePath?: string): string;
hashFile(files: string | { [file: string]: string }): string;
getRelativePathAsync(context: string): Promise<string>;
resolveReadFiles(compiler: Compiler): void;
resolveConcatAndUglify(compilation: webpack.compilation.Compilation, files: string[]): void;
}
declare namespace ConcatPlugin {
interface Options {
/**
* if true the output file will be uglified
* or set uglifyjs options to customize the output
* @default false
*/
uglify?: boolean | MinifyOptions | undefined;
/**
* if true, will output sourcemap
* @default false
*/
sourceMap?: boolean | undefined;
/**
* it's useful when you want to inject to html-webpack-plugin manually
* @default 'result'
*/
name?: string | undefined;
/**
* if set, will be used as the public path of the script tag.
* if set to false, will use relativePath.
*/
publicPath?: string | boolean | undefined;
/**
* if set, will be used as the output directory of the file.
*/
outputPath?: string | undefined;
/**
* if set, will be used as the output fileName
* @default '[name].js'
*/
fileName?: string | undefined;
/**
* supported path patterns:
* - normal path
* - npm packages
* - glob
*/
filesToConcat: Array<string | string[]>;
/**
* how to auto inject to html-webpack-plugin
* (only if html-webpack-plugin set inject option not to be false)
* @default 'prepend'
*/
injectType?: "prepend" | "append" | "none" | undefined;
/** if set, will be used as the extra attributes of the script tag. */
attributes?: {
[key: string]: any;
} | undefined;
}
}
export = ConcatPlugin;
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
* Dependencies: [@types/uglify-js](https://npmjs.com/package/@types/uglify-js), [@types/webpack](https://npmjs.com/package/@types/webpack)
# Credits
These definitions were written by [Piotr Błażejewicz](https://github.com/peterblazejewicz).