Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When building with yarn build:production, assets should get unique file hashes. #2134

Closed
5 of 6 tasks
pkarjala opened this issue Dec 4, 2018 · 1 comment
Closed
5 of 6 tasks

Comments

@pkarjala
Copy link

pkarjala commented Dec 4, 2018

Submit a feature request or bug report


What is the current behavior?

When running yarn build:production, assets are compiled and all .js files and .css files are built with the same hash.

What is the expected or desired behavior?

Hashes should be per file, not per filetype. This has implications with unnecessarily overwriting files when deploying to production as well. It is also not accurately representative of the actual hash of the file's contents.


Bug report

Please provide steps to reproduce, including full log output:

Take any Sage 9 theme and build with yarn build:production. Will result in all .js and .css files that are built for the ./dist/scripts/ and ./dist/css/ directories to have the same asset hash. See the following example build:

yarn build:production
yarn run v1.12.3
warning package.json: "dependencies" has dependency "stylelint-webpack-plugin" with range "^0.10.4" that collides with a dependency in "devDependencies" of the same name with version "^0.10.1"
warning package.json: "dependencies" has dependency "webpack" with range "^3.11.0" that collides with a dependency in "devDependencies" of the same name with version "~3.10.0"
$ webpack --progress -p --config resources/assets/build/webpack.config.js
 95% emitting

 DONE  Compiled successfully in 27841ms                                                                                                             08:58:15

                                       Asset       Size  Chunks                    Chunk Names
   scripts/profile_search_7c56dbc4.js    76.4 kB       4  [emitted]         profile_search
   styles/webfonts/fa-light-300_0168148b.eot     234 kB          [emitted]
   styles/webfonts/fa-solid-900_f7dce41b.eot     186 kB          [emitted]
 styles/webfonts/fa-light-300_b6a503f4.woff2      82 kB          [emitted]
  styles/webfonts/fa-light-300_57e3d393.woff     107 kB          [emitted]
   styles/webfonts/fa-light-300_fa2f6b92.ttf     234 kB          [emitted]
   styles/webfonts/fa-light-300_a2e70356.svg     649 kB          [emitted]  [big]
styles/webfonts/fa-brands-400_cd221017.woff2    61.3 kB          [emitted]
 styles/webfonts/fa-brands-400_8f68c248.woff    71.6 kB          [emitted]
  styles/webfonts/fa-brands-400_7483aed6.ttf     112 kB          [emitted]
  styles/webfonts/fa-brands-400_a6cc237a.svg     349 kB          [emitted]  [big]
 styles/webfonts/fa-solid-900_c4fc4e6d.woff2    64.4 kB          [emitted]
  styles/webfonts/fa-solid-900_66db095d.woff      84 kB          [emitted]
   styles/webfonts/fa-solid-900_62f877c4.ttf     186 kB          [emitted]
   styles/webfonts/fa-solid-900_8dc59ef6.svg     505 kB          [emitted]  [big]
     vendor/fontawesome-webfont_674f50d2.eot     166 kB          [emitted]
   vendor/fontawesome-webfont_af7ae505.woff2    77.2 kB          [emitted]
    vendor/fontawesome-webfont_fee66e71.woff      98 kB          [emitted]
     vendor/fontawesome-webfont_b06871f2.ttf     166 kB          [emitted]
     vendor/fontawesome-webfont_912ec66d.svg     388 kB          [emitted]  [big]
                scripts/calendar_7c56dbc4.js     310 kB       0  [emitted]  [big]  calendar
         scripts/forms-docs.ajax_7c56dbc4.js     104 kB       1  [emitted]         forms-docs.ajax
               scripts/templates_7c56dbc4.js    97.1 kB       2  [emitted]         templates
                    scripts/main_7c56dbc4.js      76 kB       3  [emitted]         main
  styles/webfonts/fa-brands-400_16c7fb89.eot     112 kB          [emitted]
               scripts/home_page_7c56dbc4.js    44.2 kB       5  [emitted]         home_page
                 scripts/archive_7c56dbc4.js    75.7 kB       6  [emitted]         archive
                  scripts/wplink_7c56dbc4.js    13.4 kB       7  [emitted]         wplink
        scripts/remove_templates_7c56dbc4.js  802 bytes       8  [emitted]         remove_templates
    scripts/remove_links_7c56dbc4.js  806 bytes       9  [emitted]         remove_links
             scripts/prospective_7c56dbc4.js  924 bytes      10  [emitted]         prospective
                    scripts/menu_7c56dbc4.js  858 bytes      11  [emitted]         menu
                    scripts/maps_7c56dbc4.js    1.47 kB      12  [emitted]         maps
          scripts/jquery-deparam_7c56dbc4.js    1.28 kB      13  [emitted]         jquery-deparam
                    scripts/faqs_7c56dbc4.js  914 bytes      14  [emitted]         faqs
               scripts/directory_7c56dbc4.js    1.36 kB      15  [emitted]         directory
              scripts/customizer_7c56dbc4.js  774 bytes      16  [emitted]         customizer
              scripts/coe_common_7c56dbc4.js  887 bytes      17  [emitted]         coe_common
              scripts/accordions_7c56dbc4.js  903 bytes      18  [emitted]         accordions
               scripts/common_js_7c56dbc4.js    1.57 kB      19  [emitted]         common_js
                   scripts/admin_7c56dbc4.js  569 bytes      20  [emitted]         admin
                    styles/main_7c56dbc4.css     163 kB       3  [emitted]         main
                   styles/admin_7c56dbc4.css    3.79 kB      20  [emitted]         admin
                      images/bg_cd658513.jpg    10.1 kB          [emitted]
          images/coe-logo-white_144fe760.svg    10.6 kB          [emitted]
            images/coe-web-logo_daed10f1.svg    9.64 kB          [emitted]
        images/white-left_9480cfad.svg    34.8 kB          [emitted]
       images/color-logo_cb569e3a.png    13.5 kB          [emitted]
                                 assets.json     3.5 kB          [emitted]
Done in 43.83s.

Note that all .js and .css files have the same hash of 7c56dbc4. Editing a single one of these assets and running yarn build:production again will result in the rest getting a new but identical hash.

Please describe your local environment:

WordPress version: 4.9.8

OS: Ubuntu 18.04

NPM/Node version: 9.11.2

Where did the bug happen? Development or remote servers?

Both Development and Remote servers.

Is there a related Discourse thread or were any utilized (please link them)?

N/A

@Log1x
Copy link
Member

Log1x commented Jun 18, 2019

#2172

@Log1x Log1x closed this as completed Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants