mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
- type definition - tests https://github.com/hxlniada/webpack-concat-plugin#readme Thanks!
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import ConcatPlugin = require('webpack-concat-plugin');
|
|
import { Compiler } from 'webpack';
|
|
import webpack = require('webpack');
|
|
|
|
const webpackCompiler: Compiler = {} as any;
|
|
|
|
const plugin = new ConcatPlugin();
|
|
plugin.apply(webpackCompiler);
|
|
plugin.ensureTrailingSlash('some/path/'); // $ExpectType string
|
|
plugin.getFileName('aa', '[name].[hash].js'); // $ExpectType string
|
|
plugin.hashFile('aa'); // $ExpectType string
|
|
plugin.getRelativePathAsync('some/path'); // $ExpectType Promise<string>
|
|
plugin.resolveReadFiles(webpackCompiler); // $ExpectType void
|
|
|
|
// options
|
|
new ConcatPlugin({
|
|
uglify: false,
|
|
sourceMap: false,
|
|
name: 'result',
|
|
outputPath: 'path/to/output/',
|
|
fileName: '[name].[hash:8].js',
|
|
filesToConcat: ['jquery', './src/lib/**', './dep/dep.js', ['./some/**', '!./some/excludes/**']],
|
|
attributes: {
|
|
async: true,
|
|
},
|
|
});
|
|
|
|
// UglifyJS options
|
|
new ConcatPlugin({
|
|
uglify: {
|
|
toplevel: true,
|
|
compress: {
|
|
global_defs: {
|
|
'@console.log': 'alert',
|
|
},
|
|
passes: 2,
|
|
},
|
|
output: {
|
|
beautify: false,
|
|
preamble: '/* uglified */',
|
|
},
|
|
},
|
|
filesToConcat: ['jquery', './src/lib/**', './dep/dep.js', ['./some/**', '!./some/excludes/**']],
|
|
});
|
|
|
|
const config: webpack.Configuration = {
|
|
entry: './index.js',
|
|
plugins: [
|
|
new ConcatPlugin({
|
|
uglify: true,
|
|
sourceMap: true,
|
|
name: 'file',
|
|
fileName: '[name].[hash:20].js',
|
|
injectType: 'none',
|
|
filesToConcat: ['../../fixtures/a.js', '../../fixtures/b.js'],
|
|
}),
|
|
],
|
|
};
|