Ticket #45119: 45119.diff
File 45119.diff, 2.9 KB (added by , 5 years ago) |
---|
-
.gitignore
18 18 /wp-cli.local.yml 19 19 /jsdoc 20 20 /vendor 21 /src/js/dist 22 /src/css/dist 21 23 22 24 # Files and folders that get created in wp-content 23 25 /src/wp-content/blogs.dir -
tools/webpack/packages.js
37 37 /** 38 38 * Maps vendors to copy commands for the CopyWebpackPlugin. 39 39 * 40 * @param {Object} vendors Vendors to include in the vendor folder. 40 * @param {Object} vendors Vendors to include in the vendor folder. 41 * @param {string} buildTarget The folder in which to build the packages. 41 42 * 42 43 * @return {Object[]} Copy object suitable for the CopyWebpackPlugin. 43 44 */ 44 function mapVendorCopies( vendors ) {45 function mapVendorCopies( vendors, buildTarget ) { 45 46 return Object.keys( vendors ).map( ( filename ) => ( { 46 47 from: join( baseDir, `node_modules/${ vendors[ filename ] }` ), 47 to: join( baseDir, ` build/js/dist/vendor/${ filename }` ),48 to: join( baseDir, `${ buildTarget }/js/dist/vendor/${ filename }` ), 48 49 } ) ); 49 50 } 50 51 … … 51 52 module.exports = function( env = { environment: 'production', watch: false } ) { 52 53 const mode = env.environment; 53 54 const suffix = mode === 'production' ? '.min': ''; 55 const buildTarget = mode === 'production' ? 'build': 'src'; 54 56 55 57 const packages = [ 56 58 'api-fetch', … … 143 145 }; 144 146 } ); 145 147 146 const developmentCopies = mapVendorCopies( vendors );147 const minifiedCopies = mapVendorCopies( minifiedVendors );148 const minifyCopies = mapVendorCopies( minifyVendors ).map( ( copyCommand ) => {148 const developmentCopies = mapVendorCopies( vendors, buildTarget ); 149 const minifiedCopies = mapVendorCopies( minifiedVendors, buildTarget ); 150 const minifyCopies = mapVendorCopies( minifyVendors, buildTarget ).map( ( copyCommand ) => { 149 151 return { 150 152 ...copyCommand, 151 153 transform: ( content ) => { … … 158 160 159 161 let cssCopies = packages.map( ( packageName ) => ( { 160 162 from: join( baseDir, `node_modules/@wordpress/${ packageName }/build-style/*.css` ), 161 to: join( baseDir, ` build/styles/dist/${ packageName }/` ),163 to: join( baseDir, `${ buildTarget }/styles/dist/${ packageName }/` ), 162 164 flatten: true, 163 165 transform: ( content ) => { 164 166 if ( config.mode === 'production' ) { … … 190 192 }, {} ), 191 193 output: { 192 194 filename: `[basename]${ suffix }.js`, 193 path: join( baseDir, 'build/js/dist'),195 path: join( baseDir, `${ buildTarget }/js/dist` ), 194 196 library: { 195 197 root: [ 'wp', '[name]' ] 196 198 }, -
.