mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
4f64273933
Update webpack version to latest version https://www.npmjs.com/package/webpack. This aligns closer with how the Gutenberg plugin handles WordPress packages. Related update in Gutenberg from August 2021: https://github.com/WordPress/gutenberg/pull/33818. Props walbo, desrosj, mukesh27. Fixes #51750. git-svn-id: https://develop.svn.wordpress.org/trunk@53135 602fd350-edb4-49c9-b593-d223f7449a82
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
/**
|
|
* External dependencies
|
|
*/
|
|
const TerserPlugin = require( 'terser-webpack-plugin' );
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
const { baseDir } = require( './shared' );
|
|
|
|
module.exports = function( env = { environment: 'production', watch: false, buildTarget: false } ) {
|
|
const entry = {
|
|
[ env.buildTarget + 'wp-includes/js/media-audiovideo.js' ]: ['./src/js/_enqueues/wp/media/audiovideo.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-audiovideo.min.js' ]: ['./src/js/_enqueues/wp/media/audiovideo.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-grid.js' ]: ['./src/js/_enqueues/wp/media/grid.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-grid.min.js' ]: ['./src/js/_enqueues/wp/media/grid.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-models.js' ]: ['./src/js/_enqueues/wp/media/models.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-models.min.js' ]: ['./src/js/_enqueues/wp/media/models.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-views.js' ]: ['./src/js/_enqueues/wp/media/views.js'],
|
|
[ env.buildTarget + 'wp-includes/js/media-views.min.js' ]: ['./src/js/_enqueues/wp/media/views.js'],
|
|
};
|
|
|
|
const mediaConfig = {
|
|
target: 'browserslist',
|
|
mode: "production",
|
|
cache: true,
|
|
entry,
|
|
output: {
|
|
path: baseDir,
|
|
filename: '[name]',
|
|
},
|
|
optimization: {
|
|
minimize: true,
|
|
moduleIds: 'deterministic',
|
|
minimizer: [
|
|
new TerserPlugin( {
|
|
include: /\.min\.js$/,
|
|
extractComments: false,
|
|
} ),
|
|
]
|
|
},
|
|
watch: env.watch,
|
|
};
|
|
|
|
return mediaConfig;
|
|
};
|