55var OptionsApply = require ( "./OptionsApply" ) ;
66
77var FunctionModulePlugin = require ( "./FunctionModulePlugin" ) ;
8- var JsonpTemplatePlugin = require ( "./JsonpTemplatePlugin" ) ;
9- var WebWorkerTemplatePlugin = require ( "./webworker/WebWorkerTemplatePlugin" ) ;
10- var NodeTemplatePlugin = require ( "./node/NodeTemplatePlugin" ) ;
118var EvalDevToolModulePlugin = require ( "./EvalDevToolModulePlugin" ) ;
129var SourceMapDevToolPlugin = require ( "./SourceMapDevToolPlugin" ) ;
13- var LibraryTemplatePlugin = require ( "./LibraryTemplatePlugin" ) ;
14- var HotModuleReplacementPlugin = require ( "./HotModuleReplacementPlugin" ) ;
15- var NoHotModuleReplacementPlugin = require ( "./NoHotModuleReplacementPlugin" ) ;
1610
17- var PrefetchPlugin = require ( "./PrefetchPlugin" ) ;
1811var SingleEntryPlugin = require ( "./SingleEntryPlugin" ) ;
1912var MultiEntryPlugin = require ( "./MultiEntryPlugin" ) ;
20- var CachePlugin = require ( "./CachePlugin" ) ;
2113var RecordIdsPlugin = require ( "./RecordIdsPlugin" ) ;
2214
2315var APIPlugin = require ( "./APIPlugin" ) ;
2416var ConstPlugin = require ( "./ConstPlugin" ) ;
2517var RequireJsStuffPlugin = require ( "./RequireJsStuffPlugin" ) ;
2618var NodeStuffPlugin = require ( "./NodeStuffPlugin" ) ;
2719var CompatibilityPlugin = require ( "./CompatibilityPlugin" ) ;
28- var ProvidePlugin = require ( "./ProvidePlugin" ) ;
29- var NodeSourcePlugin = require ( "./node/NodeSourcePlugin" ) ;
30- var NodeTargetPlugin = require ( "./node/NodeTargetPlugin" ) ;
3120
3221var CommonJsPlugin = require ( "./dependencies/CommonJsPlugin" ) ;
3322var AMDPlugin = require ( "./dependencies/AMDPlugin" ) ;
@@ -36,15 +25,10 @@ var RequireContextPlugin = require("./dependencies/RequireContextPlugin");
3625var RequireEnsurePlugin = require ( "./dependencies/RequireEnsurePlugin" ) ;
3726var RequireIncludePlugin = require ( "./dependencies/RequireIncludePlugin" ) ;
3827
39- var UglifyJsPlugin = require ( "./optimize/UglifyJsPlugin" ) ;
40- var OccurenceOrderPlugin = require ( "./optimize/OccurenceOrderPlugin" ) ;
41- var LimitChunkCountPlugin = require ( "./optimize/LimitChunkCountPlugin" ) ;
42- var MinChunkSizePlugin = require ( "./optimize/MinChunkSizePlugin" ) ;
4328var RemoveParentModulesPlugin = require ( "./optimize/RemoveParentModulesPlugin" ) ;
4429var RemoveEmptyChunksPlugin = require ( "./optimize/RemoveEmptyChunksPlugin" ) ;
4530var MergeDuplicateChunksPlugin = require ( "./optimize/MergeDuplicateChunksPlugin" ) ;
4631var FlagIncludedChunksPlugin = require ( "./optimize/FlagIncludedChunksPlugin" ) ;
47- var DedupePlugin = require ( "./optimize/DedupePlugin" ) ;
4832
4933var UnsafeCachePlugin = require ( "enhanced-resolve/lib/UnsafeCachePlugin" ) ;
5034var ModulesInDirectoriesPlugin = require ( "enhanced-resolve/lib/ModulesInDirectoriesPlugin" ) ;
@@ -74,20 +58,26 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
7458 compiler . recordsOutputPath = options . recordsOutputPath || options . recordsPath ;
7559 switch ( options . target ) {
7660 case "web" :
61+ var JsonpTemplatePlugin = require ( "./JsonpTemplatePlugin" ) ;
62+ var NodeSourcePlugin = require ( "./node/NodeSourcePlugin" ) ;
7763 compiler . apply (
7864 new JsonpTemplatePlugin ( options . output ) ,
7965 new FunctionModulePlugin ( options . context , options . output ) ,
8066 new NodeSourcePlugin ( options . node )
8167 ) ;
8268 break ;
8369 case "webworker" :
70+ var WebWorkerTemplatePlugin = require ( "./webworker/WebWorkerTemplatePlugin" ) ;
71+ var NodeSourcePlugin = require ( "./node/NodeSourcePlugin" ) ;
8472 compiler . apply (
8573 new WebWorkerTemplatePlugin ( options . output ) ,
8674 new FunctionModulePlugin ( options . context , options . output ) ,
8775 new NodeSourcePlugin ( options . node )
8876 ) ;
8977 break ;
9078 case "node" :
79+ var NodeTemplatePlugin = require ( "./node/NodeTemplatePlugin" ) ;
80+ var NodeTargetPlugin = require ( "./node/NodeTargetPlugin" ) ;
9181 compiler . apply (
9282 new NodeTemplatePlugin ( options . output ) ,
9383 new FunctionModulePlugin ( options . context , options . output ) ,
@@ -96,12 +86,15 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
9686 break ;
9787 }
9888 if ( options . output . library || options . output . libraryTarget != "var" ) {
89+ var LibraryTemplatePlugin = require ( "./LibraryTemplatePlugin" ) ;
9990 compiler . apply ( new LibraryTemplatePlugin ( options . output . library , options . output . libraryTarget ) ) ;
10091 }
10192
10293 if ( options . hot ) {
94+ var HotModuleReplacementPlugin = require ( "./HotModuleReplacementPlugin" ) ;
10395 compiler . apply ( new HotModuleReplacementPlugin ( options . output ) ) ;
10496 } else {
97+ var NoHotModuleReplacementPlugin = require ( "./NoHotModuleReplacementPlugin" ) ;
10598 compiler . apply ( new NoHotModuleReplacementPlugin ( ) ) ;
10699 }
107100
@@ -153,6 +146,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
153146 }
154147
155148 if ( options . prefetch ) {
149+ var PrefetchPlugin = require ( "./PrefetchPlugin" ) ;
156150 options . prefetch . map ( function ( request ) {
157151 compiler . apply ( new PrefetchPlugin ( options . context , request ) ) ;
158152 } ) ;
@@ -180,27 +174,41 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
180174
181175 compiler . apply ( new RecordIdsPlugin ( ) ) ;
182176
183- if ( options . optimize && options . optimize . occurenceOrder )
177+ if ( options . optimize && options . optimize . occurenceOrder ) {
178+ var OccurenceOrderPlugin = require ( "./optimize/OccurenceOrderPlugin" ) ;
184179 compiler . apply ( new OccurenceOrderPlugin ( options . optimize . occurenceOrderPreferEntry ) ) ;
180+ }
185181
186- if ( options . optimize && options . optimize . minChunkSize )
182+ if ( options . optimize && options . optimize . minChunkSize ) {
183+ var MinChunkSizePlugin = require ( "./optimize/MinChunkSizePlugin" ) ;
187184 compiler . apply ( new MinChunkSizePlugin ( options . optimize ) ) ;
185+ }
188186
189- if ( options . optimize && options . optimize . maxChunks )
187+ if ( options . optimize && options . optimize . maxChunks ) {
188+ var LimitChunkCountPlugin = require ( "./optimize/LimitChunkCountPlugin" ) ;
190189 compiler . apply ( new LimitChunkCountPlugin ( options . optimize ) ) ;
190+ }
191191
192- if ( options . optimize . minimize === true )
193- compiler . apply ( new UglifyJsPlugin ( ) ) ;
194- else if ( options . optimize . minimize )
195- compiler . apply ( new UglifyJsPlugin ( options . optimize . minimize ) ) ;
192+ if ( options . optimize . minimize ) {
193+ var UglifyJsPlugin = require ( "./optimize/UglifyJsPlugin" ) ;
194+ if ( options . optimize . minimize === true )
195+ compiler . apply ( new UglifyJsPlugin ( ) ) ;
196+ else
197+ compiler . apply ( new UglifyJsPlugin ( options . optimize . minimize ) ) ;
198+ }
196199
197- if ( options . optimize . dedupe === true )
200+ if ( options . optimize . dedupe === true ) {
201+ var DedupePlugin = require ( "./optimize/DedupePlugin" ) ;
198202 compiler . apply ( new DedupePlugin ( ) ) ;
203+ }
199204
200- if ( options . cache === undefined ? options . watch : options . cache )
205+ if ( options . cache === undefined ? options . watch : options . cache ) {
206+ var CachePlugin = require ( "./CachePlugin" ) ;
201207 compiler . apply ( new CachePlugin ( typeof options . cache == "object" ? options . cache : null ) ) ;
208+ }
202209
203210 if ( typeof options . provide === "object" ) {
211+ var ProvidePlugin = require ( "./ProvidePlugin" ) ;
204212 for ( var name in options . provide ) {
205213 compiler . apply ( new ProvidePlugin ( name , options . provide [ name ] ) ) ;
206214 }
0 commit comments