mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Add webpack
This commit is contained in:
47
webpack/webpack-tests.ts
Normal file
47
webpack/webpack-tests.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/// <reference path="webpack.d.ts" />
|
||||
|
||||
import webpack from 'webpack';
|
||||
//import webpack = require('webpack');
|
||||
|
||||
var configuration: webpack.Configuration;
|
||||
var loader: webpack.Loader;
|
||||
var plugin: webpack.Plugin;
|
||||
|
||||
//
|
||||
// https://webpack.github.io/docs/using-loaders.html
|
||||
//
|
||||
|
||||
configuration = {
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.jade$/, loader: "jade" },
|
||||
// => "jade" loader is used for ".jade" files
|
||||
|
||||
{ test: /\.css$/, loader: "style!css" },
|
||||
// => "style" and "css" loader is used for ".css" files
|
||||
// Alternative syntax:
|
||||
{ test: /\.css$/, loaders: ["style", "css"] },
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
loader = { test: /\.png$/, loader: "url-loader?mimetype=image/png" };
|
||||
|
||||
loader = {
|
||||
test: /\.png$/,
|
||||
loader: "url-loader",
|
||||
query: { mimetype: "image/png" }
|
||||
};
|
||||
|
||||
//
|
||||
// https://webpack.github.io/docs/using-plugins.html
|
||||
//
|
||||
|
||||
configuration = {
|
||||
plugins: [
|
||||
new webpack.ResolverPlugin([
|
||||
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
|
||||
], ["normal", "loader"])
|
||||
]
|
||||
};
|
||||
|
||||
53
webpack/webpack.d.ts
vendored
Normal file
53
webpack/webpack.d.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
// Type definitions for webpack
|
||||
// Project: https://github.com/webpack/webpack
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "webpack" {
|
||||
namespace webpack {
|
||||
interface Configuration {
|
||||
module?: Module;
|
||||
plugins?: Plugin[];
|
||||
}
|
||||
|
||||
interface Module {
|
||||
loaders?: Loader[];
|
||||
}
|
||||
|
||||
interface Loader {
|
||||
test: RegExp;
|
||||
loader?: string;
|
||||
loaders?: string[];
|
||||
query?: {
|
||||
[name: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Plugin {
|
||||
}
|
||||
|
||||
interface ResolverPlugin extends Plugin {
|
||||
}
|
||||
|
||||
interface ResolverPluginStatic {
|
||||
new(plugins: Plugin[], files: string[]): ResolverPlugin;
|
||||
DirectoryDescriptionFilePlugin: DirectoryDescriptionFilePluginStatic;
|
||||
}
|
||||
|
||||
interface DirectoryDescriptionFilePlugin extends Plugin {
|
||||
}
|
||||
|
||||
interface DirectoryDescriptionFilePluginStatic {
|
||||
new(file: string, files: string[]): DirectoryDescriptionFilePlugin;
|
||||
}
|
||||
|
||||
interface Webpack {
|
||||
ResolverPlugin: ResolverPluginStatic;
|
||||
}
|
||||
}
|
||||
|
||||
var webpack: webpack.Webpack;
|
||||
|
||||
export default webpack;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user