Skip to content

Commit a35e46a

Browse files
committed
Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build.
This patch integrates DependencyExtractionWebpackPlugin which was battle-tested in Gutenberg. This will greatly simplify the process of upgrading npm packages which change after every Gutenberg release. It might even useful during the WordPress release cycle as we might need to publish more often as we discover critical bugs and regressions. Props jonsurrell, adamsilverstein, youknowriad, ocean90, netweb. Fixes #48154. git-svn-id: https://develop.svn.wordpress.org/trunk@47035 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c27ab74 commit a35e46a

File tree

8 files changed

+1582
-1226
lines changed

8 files changed

+1582
-1226
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wp-tests-config.php
2424
/src/wp-admin/css/*-rtl.css
2525
/src/wp-admin/css/colors/*/*.css
2626
/src/wp-admin/js
27+
/src/wp-includes/assets
2728
/src/wp-includes/js
2829
/src/wp-includes/css/dist
2930
/src/wp-includes/css/*.min.css

Gruntfile.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,12 @@ module.exports = function(grunt) {
108108
],
109109
js: [
110110
WORKING_DIR + 'wp-admin/js/',
111+
WORKING_DIR + 'wp-includes/assets/',
111112
WORKING_DIR + 'wp-includes/js/'
112113
],
114+
'webpack-assets': [
115+
WORKING_DIR + 'wp-includes/js/**/*.asset.php'
116+
],
113117
dynamic: {
114118
dot: true,
115119
expand: true,
@@ -137,6 +141,7 @@ module.exports = function(grunt) {
137141
expand: true,
138142
cwd: SOURCE_DIR,
139143
src: buildFiles.concat( [
144+
'!assets/**', // Assets is extracted into separate copy tasks.
140145
'!js/**', // JavaScript is extracted into separate copy tasks.
141146
'!.{svn,git}', // Exclude version control folders.
142147
'!wp-includes/version.php', // Exclude version.php
@@ -345,6 +350,12 @@ module.exports = function(grunt) {
345350
}
346351
]
347352
},
353+
'webpack-assets': {
354+
expand: true,
355+
cwd: WORKING_DIR + 'wp-includes/js/',
356+
src: 'dist/*.asset.php',
357+
dest: WORKING_DIR + 'wp-includes/assets/'
358+
},
348359
version: {
349360
options: {
350361
processContent: function( src ) {
@@ -1350,10 +1361,16 @@ module.exports = function(grunt) {
13501361
'uglify:jqueryform'
13511362
] );
13521363

1353-
grunt.registerTask( 'build:js', [
1354-
'clean:js',
1364+
grunt.registerTask( 'build:webpack', [
13551365
'webpack:prod',
13561366
'webpack:dev',
1367+
'copy:webpack-assets',
1368+
'clean:webpack-assets',
1369+
] );
1370+
1371+
grunt.registerTask( 'build:js', [
1372+
'clean:js',
1373+
'build:webpack',
13571374
'copy:js',
13581375
'file_append',
13591376
'uglify:all',

0 commit comments

Comments
 (0)