66const path = require ( 'path' ) ;
77const defaultConfig = require ( '@wordpress/scripts/config/webpack.config' ) ;
88
9- const CopyPlugin = require ( 'copy-webpack-plugin' ) ;
109const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
1110
1211const entry = {
@@ -15,43 +14,6 @@ const entry = {
1514 'hello-admin' : path . resolve ( __dirname , './assets/dev/js/admin/hello-admin.js' ) ,
1615} ;
1716
18- const copyPluginConfig = new CopyPlugin ( {
19- patterns : [
20- {
21- from : '**/*' ,
22- context : __dirname ,
23- to : path . resolve ( __dirname , 'build' ) ,
24- // Terser skip this file for minimization
25- info : { minimized : true } ,
26- globOptions : {
27- ignore : [
28- // ignore minified php files
29- ...Object . keys ( entry ) . map ( ( key ) => `**/assets/js/${ key } .min.asset.php` ) ,
30- '**.zip' ,
31- '**.css' ,
32- '**/karma.conf.js' ,
33- '**/assets/dev/**' ,
34- '**/assets/scss/**' ,
35- '**/assets/js/qunit-tests*' ,
36- '**/bin/**' ,
37- '**/build/**' ,
38- '**/composer.json' ,
39- '**/composer.lock' ,
40- '**/Gruntfile.js' ,
41- '**/node_modules/**' ,
42- '**/npm-debug.log' ,
43- '**/package-lock.json' ,
44- '**/package.json' ,
45- '**/phpcs.xml' ,
46- '**/README.md' ,
47- '**/webpack.config.js' ,
48- '**/vendor/**' ,
49- ] ,
50- } ,
51- } ,
52- ] ,
53- } ) ;
54-
5517const moduleRules = {
5618 rules : [
5719 ...defaultConfig . module . rules ,
@@ -125,13 +87,7 @@ Object.entries( webpackProductionConfig.entry ).forEach( ( [ wpEntry, value ] )
12587 webpackProductionConfig . entry [ wpEntry + '.min' ] = value ;
12688} ) ;
12789
128- // Override copyPluginConfig
129- // we first remove the one supplied by @wordpress /scripts
130- webpackProductionConfig . plugins = webpackProductionConfig . plugins . filter ( ( plugin ) => {
131- return plugin . constructor . name !== 'CopyPlugin' ;
132- } ) ;
133- // then we add our own
134- webpackProductionConfig . plugins = [ copyPluginConfig , ...defaultConfig . plugins ] ;
90+ webpackProductionConfig . plugins = defaultConfig . plugins ;
13591
13692module . exports = ( env ) => {
13793 if ( env . developmentLocal ) {
0 commit comments