WordPress.org

Make WordPress Core

Ticket #49196: 49196_updated_Jan15.diff

File 49196_updated_Jan15.diff, 1.2 KB (added by chipsnyder, 6 months ago)

Updated Diff based on the code review in Github

  • tools/webpack/packages.js

    diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js
    index e58b5274f3..04f9999b6f 100644
    a b const LiveReloadPlugin = require( 'webpack-livereload-plugin' ); 
    77const postcss = require( 'postcss' );
    88const UglifyJS = require( 'uglify-js' );
    99
    10 const { join, basename } = require( 'path' );
     10const { join, basename, dirname } = require( 'path' );
    1111const { get } = require( 'lodash' );
    1212
    1313/**
    module.exports = function( env = { environment: 'production', watch: false, buil 
    152152                to: join( baseDir, `src/${ phpFiles[ filename ] }` ),
    153153        } ) );
    154154
     155        const blockMetadataCopies = Object.keys( phpFiles ).map( function( filename ) {
     156                return {
     157                        filename: filename,
     158                        dir: dirname( filename ),
     159                  }
     160        } ).map( ( { filename, dir } ) => ( {
     161                from: join( baseDir, `node_modules/@wordpress/${ dir }/block.json` ),
     162                to: join( baseDir, `src/${ dirname( phpFiles[ filename ] ) }/${ basename( dir ) }.json` ),
     163        } ) );
     164
    155165        const config = {
    156166                mode,
    157167
    module.exports = function( env = { environment: 'production', watch: false, buil 
    231241                                        ...vendorCopies,
    232242                                        ...cssCopies,
    233243                                        ...phpCopies,
     244                                        ...blockMetadataCopies,
    234245                                ],
    235246                        ),
    236247                ],