[wp-trac] [WordPress Trac] #48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build

WordPress Trac noreply at wordpress.org
Thu Jan 23 11:05:58 UTC 2020


#48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build
-------------------------------------------------+-------------------------
 Reporter:  gziolo                               |       Owner:  gziolo
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.4
Component:  Script Loader                        |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback needs-patch 2nd-        |     Focuses:  javascript
  opinion                                        |
-------------------------------------------------+-------------------------

Comment (by gziolo):

 Replying to [comment:24 azaozz]
 > A big bunch of `PHP Warning:  include(.../src/wp-
 includes/assets/dist/[name].php): failed to open stream: No such file or
 directory in ...\src\wp-includes\script-loader.php on line 295` (that's
 before the phpunit tests start).

 The only case when it would happen is when someone run `npm run build:dev`
 in the past and they have JS files generated. For the fresh build, it
 should never be the case because the asset file is generated together with
 the matching JS file.

 > I may be misunderstanding but wouldn't that throw a js error or show a
 404 in the browser console?

 No, it doesn't throw. When the script dependencies are missing then you
 only see the blank page. It's a general issue with how scripts are handled
 in core.

 > Generally thinking that splitting these files is not a great idea. I
 understand that it makes it somewhat easier to build, but the "building
 tools" are to make things better/easier, not to add more complexity :)
 Integrating the DependencyExtractionWebpackPlugin shouldn't be changing
 how the (production) code works, it should be making building easier and
 keeping the code working in the most efficient/best way.
 > In that terms these 86 files may be a "temporary build step", but seems
 it would be best to add the strings from them to script-loader.php in the
 next step, and delete them. This seems pretty easy to accomplish in Grunt.

 Feel free to open a patch to refactor the existing setup in core. It seems
 like a great idea. Webpack can produce also JSON files if that would make
 it easier to process in such a scenario.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48154#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list