Skip to content

Commit f173141

Browse files
committed
Build tools: Combine webpack config files.
This prepares us for building the Gutenberg packages. Merges [43687] to trunk. See #45065. git-svn-id: https://develop.svn.wordpress.org/trunk@43978 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b8fb0ea commit f173141

3 files changed

Lines changed: 14 additions & 42 deletions

File tree

Gruntfile.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* jshint node:true */
22
/* globals Set */
3-
var webpackConfig = require( './webpack.config.prod' );
4-
var webpackDevConfig = require( './webpack.config.dev' );
3+
var webpackConfig = require( './webpack.config' );
54

65
module.exports = function(grunt) {
76
var path = require('path'),
@@ -704,8 +703,8 @@ module.exports = function(grunt) {
704703
}
705704
},
706705
webpack: {
707-
prod: webpackConfig,
708-
dev: webpackDevConfig
706+
prod: webpackConfig( { environment: 'production' } ),
707+
dev: webpackConfig( { environment: 'development' } )
709708
},
710709
concat: {
711710
tinymce: {
@@ -1090,7 +1089,6 @@ module.exports = function(grunt) {
10901089
config: {
10911090
files: [
10921091
'Gruntfile.js',
1093-
'webpack-dev.config.js',
10941092
'webpack.config.js'
10951093
]
10961094
},
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ include_files = {
1414
'build/wp-includes/js/media-views.min.js': ['./src/js/_enqueues/wp/media/views.js'],
1515
};
1616

17-
module.exports = [
18-
{
17+
module.exports = function( env = { environment: "production" } ) {
18+
const mode = env.environment;
19+
20+
const mediaConfig = {
1921
cache: true,
20-
watch: false,
2122
entry: Object.assign( admin_files, include_files ),
2223
output: {
2324
filename: '[name]',
@@ -28,5 +29,11 @@ module.exports = [
2829
minimize: true
2930
})
3031
]
32+
};
33+
34+
if ( mode === 'production' ) {
35+
mediaConfig.plugins.push( new webpack.optimize.ModuleConcatenationPlugin() );
3136
}
32-
];
37+
38+
return mediaConfig;
39+
};

webpack.config.prod.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)