You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate minified .min.js and unminified .js files for GB js entry points when building (WordPress#31732)
* Add .min.js suffix to index script depending on the presence of env var and enqueue .min.js files by default in `client-assets.php`
* Decide what to enqueue depending on the value of the SCRIPT_DEBUG env var
- If set and true, we enqueue the unminified index.js file for the given package;
- If not set or set and false, we enqueue the minified (production) index.min.js file.
* WIP
* Save unminified .js sources before minimizer runs
* No need to pass the mode anymore
* Add packaged version PoC and tests
* Package as internal monorepo npm, remove top-level PoC module
* Add test artifacts
* Use snake case for var, simplify and DRY the asset name
* Hardcode index.min.js for override scripts
* Always refer to index.asset.php as the asset loader scripts
The WebPack build generates them using the `index.asset.php` name format.
* More reliable extension replacement
* Fix lint error
* Fix php lint errors
* Fix another linter error (prefer-alphabetical-devDependencies)
* Update packages/readable-js-assets-webpack-plugin/package.json
Change the plugin version to include a '-prerelease' suffix.
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
* Update packages/readable-js-assets-webpack-plugin/README.md
Fix webpack spelling :)
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
* Add .nmprc and CHANGELOG.md
* Restrict the compressed-size-action to *.min.js assets (and *.css)
Co-authored-by: Jarda Snajdr <jsnajdr@gmail.com>
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
Copy file name to clipboardExpand all lines: packages/dependency-extraction-webpack-plugin/test/__snapshots__/build.js.snap
+20
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,26 @@ Array [
68
68
]
69
69
`;
70
70
71
+
exports[`Webpack \`has-extension-suffix\` should produce expected output: Asset file should match snapshot 1`] =`"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '99bd32161d8514cc8c0cb8b0543ace3f');"`;
72
+
73
+
exports[`Webpack \`has-extension-suffix\` should produce expected output: External modules should match snapshot 1`] =`
74
+
Array [
75
+
Object {
76
+
"externalType": "window",
77
+
"request": "lodash",
78
+
"userRequest": "lodash",
79
+
},
80
+
Object {
81
+
"externalType": "window",
82
+
"request": Array [
83
+
"wp",
84
+
"blob",
85
+
],
86
+
"userRequest": "@wordpress/blob",
87
+
},
88
+
]
89
+
`;
90
+
71
91
exports[`Webpack \`no-default\` should produce expected output: Asset file should match snapshot 1`] =`"<?php return array('dependencies' => array(), 'version' => '7cedfbba436728640c2c4961b598ab32');"`;
72
92
73
93
exports[`Webpack \`no-default\` should produce expected output: External modules should match snapshot 1`] =`Array []`;
Generate a readable non-minified JS file for each `.min.js` asset.
4
+
5
+
The end result is that for each JS entrypoint, we get a set of readable and non-minimized `.js` file and a minimized `.min.js`. This allows Gutenberg to follow the WordPress convention of adding a `.min.js` suffix to minimized JS files, while still providing a readable and unminized files that play well with the WordPress i18n machinery.
6
+
7
+
Consult the [webpack website](https://webpack.js.org) for additional information on webpack concepts.
0 commit comments