Skip to content

Commit e8f381d

Browse files
committed
update example configurations
1 parent 2201b86 commit e8f381d

File tree

33 files changed

+49
-8
lines changed

33 files changed

+49
-8
lines changed

examples/aggressive-merging/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require("path");
22
var AggressiveMergingPlugin = require("../../lib/optimize/AggressiveMergingPlugin");
33
module.exports = {
4+
mode: "production",
45
entry: {
56
pageA: "./pageA",
67
pageB: "./pageB",

examples/build-common.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ const fs = require("fs");
1111

1212
const extraArgs = "";
1313

14-
const targetArgs = global.NO_TARGET_ARGS ? "" : " ./example.js js/output.js";
14+
const hasConfiguration = fs.existsSync("webpack.config.js");
15+
const targetArgs = global.NO_TARGET_ARGS ? "" : " ./example.js js/output.js ";
1516
const displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used-exports --display-provided-exports";
16-
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) {
17+
const modeArgs = hasConfiguration ? "" : "--mode production";
18+
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) {
1719
if(stderr)
1820
console.log(stderr);
1921
if(error !== null)
@@ -25,7 +27,7 @@ cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${displayReasons}
2527
console.log(stderr);
2628
throw e;
2729
}
28-
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) {
30+
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) {
2931
console.log(stdout);
3032
if(stderr)
3133
console.log(stderr);

examples/chunkhash/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require("path");
22
var webpack = require("../../");
33
module.exports = {
4+
mode: "production",
45
entry: {
56
main: "./example",
67
common: ["./vendor"] // optional

examples/code-splitted-css-bundle/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
22
const ExtractTextPlugin = require("extract-text-webpack-plugin");
33
module.exports = {
4+
mode: "production",
45
module: {
56
rules: [
67
{

examples/coffee-script/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
mode: "production",
23
module: {
34
rules: [
45
{ test: /\.coffee$/, loader: "coffee-loader" }

examples/common-chunk-and-vendor-chunk/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var path = require("path");
22
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
33

44
module.exports = {
5+
mode: "production",
56
entry: {
67
vendor: ["./vendor1", "./vendor2"],
78
pageA: "./pageA",

examples/common-chunk-grandchildren/webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require("path");
44

55
module.exports = [
66
{
7+
mode: "production",
78
entry: {
89
main: ["./example.js"]
910
},
@@ -21,6 +22,7 @@ module.exports = [
2122
]
2223
},
2324
{
25+
mode: "production",
2426
entry: {
2527
main: ["./example.js"]
2628
},

examples/css-bundle/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
22
const ExtractTextPlugin = require("extract-text-webpack-plugin");
33
module.exports = {
4+
mode: "production",
45
module: {
56
rules: [
67
{

examples/dll-app-and-vendor/0-vendor/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var path = require("path");
22
var webpack = require("../../../");
33

44
module.exports = {
5+
mode: "production",
56
context: __dirname,
67
entry: ["example-vendor"],
78
output: {

examples/dll-app-and-vendor/1-app/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var path = require("path");
22
var webpack = require("../../../");
33

44
module.exports = {
5+
mode: "production",
56
context: __dirname,
67
entry: "./example-app",
78
output: {

0 commit comments

Comments
 (0)