Skip to content

Commit

Permalink
Add webpack-config package (#21482)
Browse files Browse the repository at this point in the history
This is intended to (eventually) take care of several issues in the
monorepo:

* Calypso [doesn't use their own calyspo-build webpack config][1],
  which means it's not likely to be well-maintained.
  * It needs a hack to [work with monorepo packages][2].
  * And another to [get correct image paths][3].
  * And it [tries to redefine NODE_ENV, producing warnings][4].
  * And we have to [override a weird default everywhere][5].
* We have to [name our JS files with ".min.js"][6] to avoid their being
  broken by a wpcom minifier, but WordPress.org's translation
  infrastructure [ignores such files][7].
* The plugin used to fix the above [had to be forked][8], adds 772K to
  the plugin, and results in spurious changes in TC builds.
* The way translations are [being loaded for lazy-loaded bundles][9] is
  pretty hacky and doesn't lazy-load them.
* We can't use any cache busting for the lazy-loaded bundles, because
  embedding hashes in the filename breaks the link to the translation
  file and putting it in a query parameter [breaks building the RTL css][10].
* Webpack's minification is [losing translator comments][11].
* Calypso-build has a lot of peer dependencies we don't actually need.
  Not everything we have uses sass or postcss, and we have our own
  infrastructure for jest, react, and so on. Currently we just ignore
  the 76 warnings from that.

This is the first step towards fixing that: creating a private package
that can hold the webpack and babel config fragments that we can share
throughout the monorepo. Then we'll have a place to put the fixes for
some of the other issues too.

[1]: Automattic/jetpack#21004 (comment)
[2]: Automattic/wp-calypso#53353
[3]: Automattic/wp-calypso#56111
[4]: Automattic/wp-calypso#56291
[5]: Automattic/jetpack#21004
[6]: Automattic/jetpack#20484
[7]: Automattic/jetpack#21343
[8]: https://github.com/Automattic/jetpack/blob/7a5edd83/projects/plugins/jetpack/tools/webpack.helpers.js#L35
[9]: Automattic/jetpack#20926
[10]: Automattic/jetpack#21349
[11]: Automattic/jetpack#16549

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/1409697994
  • Loading branch information
kraftbj authored and matticbot committed Nov 1, 2021
1 parent 60cbb49 commit c5521c4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@



window['FEATURES'] = {"postcss":true};</script><script src="runtime~main.394dd747.iframe.bundle.js"></script><script src="120.4c0891ee.iframe.bundle.js"></script><script src="main.d5e0c451.iframe.bundle.js"></script></body></html>
window['FEATURES'] = {"postcss":true};</script><script src="runtime~main.394dd747.iframe.bundle.js"></script><script src="120.3425e01b.iframe.bundle.js"></script><script src="main.984d5701.iframe.bundle.js"></script></body></html>
1 change: 1 addition & 0 deletions docs/main.984d5701.iframe.bundle.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/main.d5e0c451.iframe.bundle.js

This file was deleted.

0 comments on commit c5521c4

Please sign in to comment.