mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
5e0814148e
Adjusts the packages registration after [43723]: * Combine the different registration functions into one `wp_default_packages` function. To reach this goal move the prefix logic into a function so it can be called from different locations. Use a `static` variable there to prevent duplicate inclusion of `version.php`. * Call this function from the `wp_default_scripts` action by registering it as a default filter. * Combine some of the logic in `_WP_Editors::print_tinymce_scripts` into `wp_register_tinymce_scripts`. The logic to force an uncompressed TinyMCE script file stays in `_WP_Editors::force_uncompressed_tinymce` because that logic is very specific to the classic editor. * The script handle `wp-tinymce` is now a dependency of the `editor` script handle. In combination with the previous item, this makes the classic editor work. * Adjust the syntax of the script paths to be more consistent with other WordPress code. * Always use `"production"` mode for the media files to prevent people from inadvertently committing development files. Props pento, omarreiss. Fixes #45065. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43738 602fd350-edb4-49c9-b593-d223f7449a82
33 lines
863 B
JavaScript
33 lines
863 B
JavaScript
const path = require( 'path' );
|
|
const SOURCE_DIR = 'src/';
|
|
const mediaEntries = {};
|
|
const mediaBuilds = [ 'audiovideo', 'grid', 'models', 'views' ];
|
|
|
|
mediaBuilds.forEach( function ( build ) {
|
|
var path = SOURCE_DIR + 'wp-includes/js/media';
|
|
mediaEntries[ build ] = './' + path + '/' + build + '.manifest.js';
|
|
} );
|
|
|
|
const baseDir = path.join( __dirname, '../../' );
|
|
|
|
module.exports = function( env = { environment: 'production', watch: false } ) {
|
|
|
|
const mediaConfig = {
|
|
mode: "production",
|
|
cache: true,
|
|
entry: mediaEntries,
|
|
output: {
|
|
path: path.join( baseDir, 'src/wp-includes/js' ),
|
|
filename: 'media-[name].js'
|
|
},
|
|
optimization: {
|
|
// The files are minified by uglify afterwards. We could change this
|
|
// later, but for now prevent doing the work twice.
|
|
minimize: false
|
|
},
|
|
watch: env.watch,
|
|
};
|
|
|
|
return mediaConfig;
|
|
};
|