mirror of https://github.com/webpack/webpack.git
				
				
				
			update example configurations
This commit is contained in:
		
							parent
							
								
									2201b860a5
								
							
						
					
					
						commit
						e8f381dd93
					
				|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var AggressiveMergingPlugin = require("../../lib/optimize/AggressiveMergingPlugin"); | var AggressiveMergingPlugin = require("../../lib/optimize/AggressiveMergingPlugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		pageA: "./pageA", | 		pageA: "./pageA", | ||||||
| 		pageB: "./pageB", | 		pageB: "./pageB", | ||||||
|  |  | ||||||
|  | @ -11,9 +11,11 @@ const fs = require("fs"); | ||||||
| 
 | 
 | ||||||
| const extraArgs = ""; | const extraArgs = ""; | ||||||
| 
 | 
 | ||||||
| const targetArgs = global.NO_TARGET_ARGS ? "" : " ./example.js js/output.js"; | const hasConfiguration = fs.existsSync("webpack.config.js"); | ||||||
|  | const targetArgs = global.NO_TARGET_ARGS ? "" : " ./example.js js/output.js "; | ||||||
| const displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used-exports --display-provided-exports"; | const displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used-exports --display-provided-exports"; | ||||||
| cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${displayReasons} --display-chunks --display-max-modules 99999 --display-origins --display-entrypoints --output-public-path "js/" -p ${extraArgs} ${targetArgs}`, function(error, stdout, stderr) { | const modeArgs = hasConfiguration ? "" : "--mode production"; | ||||||
|  | cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${modeArgs} ${displayReasons} --display-chunks --display-max-modules 99999 --display-origins --display-entrypoints --output-public-path "js/" -p ${extraArgs} ${targetArgs}`, function(error, stdout, stderr) { | ||||||
| 	if(stderr) | 	if(stderr) | ||||||
| 		console.log(stderr); | 		console.log(stderr); | ||||||
| 	if(error !== null) | 	if(error !== null) | ||||||
|  | @ -25,7 +27,7 @@ cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${displayReasons} | ||||||
| 		console.log(stderr); | 		console.log(stderr); | ||||||
| 		throw e; | 		throw e; | ||||||
| 	} | 	} | ||||||
| 	cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${displayReasons} --display-chunks --display-max-modules 99999 --display-origins --display-entrypoints --output-public-path "js/" --output-pathinfo ${extraArgs} ${targetArgs}`, function(error, stdout, stderr) { | 	cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${modeArgs} ${displayReasons} --display-chunks --display-max-modules 99999 --display-origins --display-entrypoints --output-public-path "js/" --output-pathinfo ${extraArgs} ${targetArgs}`, function(error, stdout, stderr) { | ||||||
| 		console.log(stdout); | 		console.log(stdout); | ||||||
| 		if(stderr) | 		if(stderr) | ||||||
| 			console.log(stderr); | 			console.log(stderr); | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var webpack = require("../../"); | var webpack = require("../../"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		main: "./example", | 		main: "./example", | ||||||
| 		common: ["./vendor"] // optional
 | 		common: ["./vendor"] // optional
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin"); | const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin"); | ||||||
| const ExtractTextPlugin = require("extract-text-webpack-plugin"); | const ExtractTextPlugin = require("extract-text-webpack-plugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	module: { | 	module: { | ||||||
| 		rules: [ | 		rules: [ | ||||||
| 			{ | 			{ | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	module: { | 	module: { | ||||||
| 		rules: [ | 		rules: [ | ||||||
| 			{ test: /\.coffee$/, loader: "coffee-loader" } | 			{ test: /\.coffee$/, loader: "coffee-loader" } | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ var path = require("path"); | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		vendor: ["./vendor1", "./vendor2"], | 		vendor: ["./vendor1", "./vendor2"], | ||||||
| 		pageA: "./pageA", | 		pageA: "./pageA", | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ const path = require("path"); | ||||||
| 
 | 
 | ||||||
| module.exports = [ | module.exports = [ | ||||||
| 	{ | 	{ | ||||||
|  | 		mode: "production", | ||||||
| 		entry: { | 		entry: { | ||||||
| 			main: ["./example.js"] | 			main: ["./example.js"] | ||||||
| 		}, | 		}, | ||||||
|  | @ -21,6 +22,7 @@ module.exports = [ | ||||||
| 		] | 		] | ||||||
| 	}, | 	}, | ||||||
| 	{ | 	{ | ||||||
|  | 		mode: "production", | ||||||
| 		entry: { | 		entry: { | ||||||
| 			main: ["./example.js"] | 			main: ["./example.js"] | ||||||
| 		}, | 		}, | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin"); | const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin"); | ||||||
| const ExtractTextPlugin = require("extract-text-webpack-plugin"); | const ExtractTextPlugin = require("extract-text-webpack-plugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	module: { | 	module: { | ||||||
| 		rules: [ | 		rules: [ | ||||||
| 			{ | 			{ | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ var path = require("path"); | ||||||
| var webpack = require("../../../"); | var webpack = require("../../../"); | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	context: __dirname, | 	context: __dirname, | ||||||
| 	entry: ["example-vendor"], | 	entry: ["example-vendor"], | ||||||
| 	output: { | 	output: { | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ var path = require("path"); | ||||||
| var webpack = require("../../../"); | var webpack = require("../../../"); | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	context: __dirname, | 	context: __dirname, | ||||||
| 	entry: "./example-app", | 	entry: "./example-app", | ||||||
| 	output: { | 	output: { | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var webpack = require("../../"); | var webpack = require("../../"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	plugins: [ | 	plugins: [ | ||||||
| 		new webpack.DllReferencePlugin({ | 		new webpack.DllReferencePlugin({ | ||||||
| 			context: path.join(__dirname, "..", "dll"), | 			context: path.join(__dirname, "..", "dll"), | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var webpack = require("../../"); | var webpack = require("../../"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	resolve: { | 	resolve: { | ||||||
| 		extensions: [".js", ".jsx"] | 		extensions: [".js", ".jsx"] | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ var webpack = require("../../"); | ||||||
| module.exports = [ | module.exports = [ | ||||||
| 	{ | 	{ | ||||||
| 		name: "vendor", | 		name: "vendor", | ||||||
|  | 		mode: "production", | ||||||
| 		entry: ["./vendor", "./vendor2"], | 		entry: ["./vendor", "./vendor2"], | ||||||
| 		output: { | 		output: { | ||||||
| 			path: path.resolve(__dirname, "js"), | 			path: path.resolve(__dirname, "js"), | ||||||
|  | @ -18,6 +19,7 @@ module.exports = [ | ||||||
| 	}, | 	}, | ||||||
| 	{ | 	{ | ||||||
| 		name: "app", | 		name: "app", | ||||||
|  | 		mode: "production", | ||||||
| 		dependencies: ["vendor"], | 		dependencies: ["vendor"], | ||||||
| 		entry: { | 		entry: { | ||||||
| 			pageA: "./pageA", | 			pageA: "./pageA", | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	output: { | 	output: { | ||||||
| 		libraryTarget: "umd" | 		libraryTarget: "umd" | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	plugins: [ | 	plugins: [ | ||||||
| 		new CommonsChunkPlugin({ | 		new CommonsChunkPlugin({ | ||||||
| 			name: "main", | 			name: "main", | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| 
 | 
 | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	plugins: [ | 	plugins: [ | ||||||
| 		new CommonsChunkPlugin({ | 		new CommonsChunkPlugin({ | ||||||
| 			// process all children of the main chunk
 | 			// process all children of the main chunk
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: "./example", | 	entry: "./example", | ||||||
| 	output: { | 	output: { | ||||||
| 		path: path.join(__dirname, "js"), | 		path: path.join(__dirname, "js"), | ||||||
|  |  | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
|  | 	optimization: { | ||||||
|  | 		concatenateModules: false | ||||||
|  | 	} | ||||||
|  | }; | ||||||
|  | @ -1,6 +1,8 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var webpack = require("../../"); | var webpack = require("../../"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
|  | 	cache: true, // better performance for the AggressiveSplittingPlugin
 | ||||||
| 	entry: "./example", | 	entry: "./example", | ||||||
| 	output: { | 	output: { | ||||||
| 		path: path.join(__dirname, "js"), | 		path: path.join(__dirname, "js"), | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		// The entry points for the pages
 | 		// The entry points for the pages
 | ||||||
| 		pageA: "./aEntry", | 		pageA: "./aEntry", | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ var languages = { | ||||||
| module.exports = Object.keys(languages).map(function(language) { | module.exports = Object.keys(languages).map(function(language) { | ||||||
| 	return { | 	return { | ||||||
| 		name: language, | 		name: language, | ||||||
|  | 		mode: "production", | ||||||
| 		entry: "./example", | 		entry: "./example", | ||||||
| 		output: { | 		output: { | ||||||
| 			path: path.join(__dirname, "js"), | 			path: path.join(__dirname, "js"), | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	module: { | 	module: { | ||||||
| 		rules: [ | 		rules: [ | ||||||
| 			{ test: /\.css$/, loader: "css-loader" } | 			{ test: /\.css$/, loader: "css-loader" } | ||||||
|  |  | ||||||
|  | @ -7,12 +7,14 @@ var outputOptions = { | ||||||
| }; | }; | ||||||
| module.exports = [{ | module.exports = [{ | ||||||
| 	name: "page", | 	name: "page", | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		page: "./page" | 		page: "./page" | ||||||
| 	}, | 	}, | ||||||
| 	output: outputOptions | 	output: outputOptions | ||||||
| }, { | }, { | ||||||
| 	name: "pageA", | 	name: "pageA", | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		pageA: "./page" | 		pageA: "./page" | ||||||
| 	}, | 	}, | ||||||
|  | @ -26,6 +28,7 @@ module.exports = [{ | ||||||
| 	] | 	] | ||||||
| }, { | }, { | ||||||
| 	name: "pageB", | 	name: "pageB", | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		pageB: "./page" | 		pageB: "./page" | ||||||
| 	}, | 	}, | ||||||
|  | @ -40,6 +43,7 @@ module.exports = [{ | ||||||
| 	] | 	] | ||||||
| }, { | }, { | ||||||
| 	name: "pageC", | 	name: "pageC", | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		pageC: "./page" | 		pageC: "./page" | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ var webpack = require("../../"); | ||||||
| module.exports = [ | module.exports = [ | ||||||
| 	{ | 	{ | ||||||
| 		name: "mobile", | 		name: "mobile", | ||||||
|  | 		mode: "production", | ||||||
| 		entry: "./example", | 		entry: "./example", | ||||||
| 		output: { | 		output: { | ||||||
| 			path: path.join(__dirname, "js"), | 			path: path.join(__dirname, "js"), | ||||||
|  | @ -16,6 +17,7 @@ module.exports = [ | ||||||
| 	}, | 	}, | ||||||
| 	{ | 	{ | ||||||
| 		name: "desktop", | 		name: "desktop", | ||||||
|  | 		mode: "production", | ||||||
| 		entry: "./example", | 		entry: "./example", | ||||||
| 		output: { | 		output: { | ||||||
| 			path: path.join(__dirname, "js"), | 			path: path.join(__dirname, "js"), | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		alpha: "./alpha", | 		alpha: "./alpha", | ||||||
| 		beta: "./beta" | 		beta: "./beta" | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		pageA: "./pageA", | 		pageA: "./pageA", | ||||||
| 		pageB: "./pageB", | 		pageB: "./pageB", | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin"); | ||||||
| const CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | const CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| const ExtractTextPlugin = require("extract-text-webpack-plugin"); | const ExtractTextPlugin = require("extract-text-webpack-plugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		A: "./a", | 		A: "./a", | ||||||
| 		B: "./b", | 		B: "./b", | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		pageA: "./pageA", | 		pageA: "./pageA", | ||||||
| 		pageB: "./pageB" | 		pageB: "./pageB" | ||||||
|  |  | ||||||
|  | @ -1,7 +1,3 @@ | ||||||
| var webpack = require("../../"); |  | ||||||
| 
 |  | ||||||
| module.exports = { | module.exports = { | ||||||
| 	plugins: [ | 	mode: "production" | ||||||
| 		new webpack.optimize.ModuleConcatenationPlugin() |  | ||||||
| 	] |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ module.exports = [ | ||||||
| 	"nosources-source-map", | 	"nosources-source-map", | ||||||
| 	"source-map", | 	"source-map", | ||||||
| ].map(devtool => ({ | ].map(devtool => ({ | ||||||
|  | 	mode: "development", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		bundle: "coffee-loader!./example.coffee", | 		bundle: "coffee-loader!./example.coffee", | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var path = require("path"); | var path = require("path"); | ||||||
| var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	entry: { | 	entry: { | ||||||
| 		vendor1: ["./vendor1"], | 		vendor1: ["./vendor1"], | ||||||
| 		vendor2: ["./vendor2"], | 		vendor2: ["./vendor2"], | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	output: { | 	output: { | ||||||
| 		webassemblyModuleFilename: "[modulehash].wasm", | 		webassemblyModuleFilename: "[modulehash].wasm", | ||||||
| 		publicPath: "js/" | 		publicPath: "js/" | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| var webpack = require("../../"); | var webpack = require("../../"); | ||||||
| module.exports = { | module.exports = { | ||||||
|  | 	mode: "production", | ||||||
| 	plugins: [ | 	plugins: [ | ||||||
| 		new webpack.LoaderOptionsPlugin({ | 		new webpack.LoaderOptionsPlugin({ | ||||||
| 			options: { | 			options: { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue