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 AggressiveMergingPlugin = require("../../lib/optimize/AggressiveMergingPlugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
pageA: "./pageA",
|
||||
pageB: "./pageB",
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ const fs = require("fs");
|
|||
|
||||
const extraArgs = "";
|
||||
|
||||
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";
|
||||
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)
|
||||
console.log(stderr);
|
||||
if(error !== null)
|
||||
|
|
@ -25,7 +27,7 @@ cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${displayReasons}
|
|||
console.log(stderr);
|
||||
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);
|
||||
if(stderr)
|
||||
console.log(stderr);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
main: "./example",
|
||||
common: ["./vendor"] // optional
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = {
|
||||
mode: "production",
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.coffee$/, loader: "coffee-loader" }
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ var path = require("path");
|
|||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
vendor: ["./vendor1", "./vendor2"],
|
||||
pageA: "./pageA",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ const path = require("path");
|
|||
|
||||
module.exports = [
|
||||
{
|
||||
mode: "production",
|
||||
entry: {
|
||||
main: ["./example.js"]
|
||||
},
|
||||
|
|
@ -21,6 +22,7 @@ module.exports = [
|
|||
]
|
||||
},
|
||||
{
|
||||
mode: "production",
|
||||
entry: {
|
||||
main: ["./example.js"]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ var path = require("path");
|
|||
var webpack = require("../../../");
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
context: __dirname,
|
||||
entry: ["example-vendor"],
|
||||
output: {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ var path = require("path");
|
|||
var webpack = require("../../../");
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
context: __dirname,
|
||||
entry: "./example-app",
|
||||
output: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
context: path.join(__dirname, "..", "dll"),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
resolve: {
|
||||
extensions: [".js", ".jsx"]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ var webpack = require("../../");
|
|||
module.exports = [
|
||||
{
|
||||
name: "vendor",
|
||||
mode: "production",
|
||||
entry: ["./vendor", "./vendor2"],
|
||||
output: {
|
||||
path: path.resolve(__dirname, "js"),
|
||||
|
|
@ -18,6 +19,7 @@ module.exports = [
|
|||
},
|
||||
{
|
||||
name: "app",
|
||||
mode: "production",
|
||||
dependencies: ["vendor"],
|
||||
entry: {
|
||||
pageA: "./pageA",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = {
|
||||
mode: "production",
|
||||
output: {
|
||||
libraryTarget: "umd"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
plugins: [
|
||||
new CommonsChunkPlugin({
|
||||
name: "main",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
plugins: [
|
||||
new CommonsChunkPlugin({
|
||||
// process all children of the main chunk
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var path = require("path");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: "./example",
|
||||
output: {
|
||||
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 webpack = require("../../");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
cache: true, // better performance for the AggressiveSplittingPlugin
|
||||
entry: "./example",
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
// The entry points for the pages
|
||||
pageA: "./aEntry",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ var languages = {
|
|||
module.exports = Object.keys(languages).map(function(language) {
|
||||
return {
|
||||
name: language,
|
||||
mode: "production",
|
||||
entry: "./example",
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = {
|
||||
mode: "production",
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.css$/, loader: "css-loader" }
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ var outputOptions = {
|
|||
};
|
||||
module.exports = [{
|
||||
name: "page",
|
||||
mode: "production",
|
||||
entry: {
|
||||
page: "./page"
|
||||
},
|
||||
output: outputOptions
|
||||
}, {
|
||||
name: "pageA",
|
||||
mode: "production",
|
||||
entry: {
|
||||
pageA: "./page"
|
||||
},
|
||||
|
|
@ -26,6 +28,7 @@ module.exports = [{
|
|||
]
|
||||
}, {
|
||||
name: "pageB",
|
||||
mode: "production",
|
||||
entry: {
|
||||
pageB: "./page"
|
||||
},
|
||||
|
|
@ -40,6 +43,7 @@ module.exports = [{
|
|||
]
|
||||
}, {
|
||||
name: "pageC",
|
||||
mode: "production",
|
||||
entry: {
|
||||
pageC: "./page"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ var webpack = require("../../");
|
|||
module.exports = [
|
||||
{
|
||||
name: "mobile",
|
||||
mode: "production",
|
||||
entry: "./example",
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
|
|
@ -16,6 +17,7 @@ module.exports = [
|
|||
},
|
||||
{
|
||||
name: "desktop",
|
||||
mode: "production",
|
||||
entry: "./example",
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var path = require("path");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
alpha: "./alpha",
|
||||
beta: "./beta"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
pageA: "./pageA",
|
||||
pageB: "./pageB",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
|
|||
const CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
A: "./a",
|
||||
B: "./b",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
pageA: "./pageA",
|
||||
pageB: "./pageB"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
var webpack = require("../../");
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new webpack.optimize.ModuleConcatenationPlugin()
|
||||
]
|
||||
mode: "production"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ module.exports = [
|
|||
"nosources-source-map",
|
||||
"source-map",
|
||||
].map(devtool => ({
|
||||
mode: "development",
|
||||
entry: {
|
||||
bundle: "coffee-loader!./example.coffee",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require("path");
|
||||
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: {
|
||||
vendor1: ["./vendor1"],
|
||||
vendor2: ["./vendor2"],
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = {
|
||||
mode: "production",
|
||||
output: {
|
||||
webassemblyModuleFilename: "[modulehash].wasm",
|
||||
publicPath: "js/"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
plugins: [
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
options: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue