Add plugins

This commit is contained in:
tkqubo
2015-09-23 23:14:28 +09:00
parent d0336ac511
commit 1025e20d03
2 changed files with 343 additions and 30 deletions
+141 -2
View File
@@ -1,7 +1,6 @@
/// <reference path="webpack.d.ts" />
import webpack from 'webpack';
//import webpack = require('webpack');
import * as webpack from 'webpack';
var configuration: webpack.Configuration;
var loader: webpack.Loader;
@@ -247,3 +246,143 @@ configuration = {
]
};
//
// https://webpack.github.io/docs/list-of-plugins.html
//
var plugin: webpack.Plugin;
var resourceRegExp: any;
var newResource: any;
var contextRegExp: any;
var newContentResource: any;
var newContentRecursive: any;
var newContentRegExp: any;
var requestRegExp: any;
var options: any;
var definitions: any;
var paths: any;
var preferEntry = true;
var context: any;
var request: any;
var types: any;
var banner: any;
var plugins: webpack.Plugin[];
plugin = new webpack.NormalModuleReplacementPlugin(resourceRegExp, newResource);
plugin = new webpack.ContextReplacementPlugin(
resourceRegExp,
newContentResource,
newContentRecursive,
newContentRegExp);
plugin = new webpack.ContextReplacementPlugin(
resourceRegExp,
newContentResource,
newContentRecursive);
plugin = new webpack.ContextReplacementPlugin(
resourceRegExp,
newContentResource);
plugin = new webpack.ContextReplacementPlugin(resourceRegExp);
plugin = new webpack.IgnorePlugin(requestRegExp);
plugin = new webpack.IgnorePlugin(requestRegExp, contextRegExp);
plugin = new webpack.PrefetchPlugin(context, request);
plugin = new webpack.PrefetchPlugin(request);
plugin = new webpack.ResolverPlugin(plugins, types);
plugin = new webpack.ResolverPlugin(plugins);
plugin = new webpack.ResolverPlugin([
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
], ["normal", "loader"]);
plugin = new webpack.ResolverPlugin([
new webpack.ResolverPlugin.FileAppendPlugin(['/dist/compiled-moduled.js'])
]);
plugin = new webpack.BannerPlugin(banner, options);
plugin = new webpack.optimize.DedupePlugin();
plugin = new webpack.optimize.LimitChunkCountPlugin(options);
plugin = new webpack.optimize.MinChunkSizePlugin(options);
plugin = new webpack.optimize.OccurenceOrderPlugin(preferEntry);
plugin = new webpack.optimize.UglifyJsPlugin(options);
plugin = new webpack.optimize.UglifyJsPlugin();
plugin = new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
});
plugin = new webpack.optimize.UglifyJsPlugin({
mangle: {
except: ['$super', '$', 'exports', 'require']
}
});
plugin = new webpack.optimize.CommonsChunkPlugin(options);
plugin = new CommonsChunkPlugin({
name: "commons",
// (the commons chunk name)
filename: "commons.js",
// (the filename of the commons chunk)
// minChunks: 3,
// (Modules must be shared between 3 entries)
// chunks: ["pageA", "pageB"],
// (Only use these entries)
});
plugin = new CommonsChunkPlugin({
// names: ["app", "subPageA"]
// (choose the chunks, or omit for all chunks)
children: true,
// (select all children of chosen chunks)
// minChunks: 3,
// (3 children must share the module before it's moved)
});
plugin = new CommonsChunkPlugin({
// names: ["app", "subPageA"]
// (choose the chunks, or omit for all chunks)
children: true,
// (use all children of the chunk)
async: true,
// (create an async commons chunk)
// minChunks: 3,
// (3 children must share the module before it's separated)
});
plugin = new webpack.optimize.AggressiveMergingPlugin(options);
plugin = new webpack.dependencies.LabeledModulesPlugin();
plugin = new webpack.DefinePlugin(definitions);
plugin = new webpack.DefinePlugin({
VERSION: JSON.stringify("5fa3b9"),
BROWSER_SUPPORTS_HTML5: true,
TWO: "1+1",
"typeof window": JSON.stringify("object")
});
plugin = new webpack.ProvidePlugin(definitions);
plugin = new webpack.ProvidePlugin({
$: "jquery"
});
plugin = new webpack.SourceMapDevToolPlugin({
//// asset matching
//test: string | RegExp | Array,
//include: string | RegExp | Array,
//exclude: string | RegExp | Array,
//
//// file and reference
//filename: string,
//append: bool | string,
//
//// sources naming
//moduleFilenameTemplate: string,
//fallbackModuleFilenameTemplate: string,
//
//// quality/performance
//module: bool,
//columns: bool,
//lineToLine: bool | object
});
plugin = new webpack.HotModuleReplacementPlugin();
plugin = new webpack.ExtendedAPIPlugin();
plugin = new webpack.NoErrorsPlugin();
plugin = new webpack.WatchIgnorePlugin(paths);