From 30d163d4423d753a53ad794f7ee1865bfcc16149 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 15 Dec 2021 14:00:47 -0500 Subject: [PATCH] Use the new i18n-loader-webpack-plugin (#21936) * webpack-config: Use `@automattic/i18n-loader-webpack-plugin` Provide the new plugin as part of the standard set of plugins. * jetpack: Use `@automattic/i18n-loader-webpack-plugin` Configure the new plugin and remove the hack Instant Search was using to work around the problem the plugin was created to fix. --- pnpm-lock.yaml | 18 +++++++----- projects/js-packages/webpack-config/README.md | 6 ++++ .../add-use-i18n-loader-webpack-plugin | 4 +++ .../js-packages/webpack-config/package.json | 3 +- .../js-packages/webpack-config/src/webpack.js | 5 ++++ .../add-use-i18n-loader-webpack-plugin | 4 +++ projects/packages/connection-ui/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ .../packages/identity-crisis/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ projects/packages/jitm/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ projects/packages/lazy-images/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ projects/packages/my-jetpack/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ projects/packages/search/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ projects/plugins/backup/package.json | 2 +- .../add-use-i18n-loader-webpack-plugin | 4 +++ .../search/class-jetpack-instant-search.php | 29 ------------------- projects/plugins/jetpack/package.json | 2 +- .../tools/webpack.config.extensions.js | 1 + .../plugins/jetpack/tools/webpack.config.js | 1 + .../tools/webpack.config.search-configure.js | 1 + .../jetpack/tools/webpack.config.search.js | 1 + .../tools/webpack.config.widget-visibility.js | 1 + 27 files changed, 72 insertions(+), 46 deletions(-) create mode 100644 projects/js-packages/webpack-config/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/packages/connection-ui/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/packages/identity-crisis/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/packages/jitm/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/packages/lazy-images/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/packages/my-jetpack/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/packages/search/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/plugins/backup/changelog/add-use-i18n-loader-webpack-plugin create mode 100644 projects/plugins/jetpack/changelog/add-use-i18n-loader-webpack-plugin diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 615a4aaa94dcd..e1bd9f8c0a8e1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -436,6 +436,7 @@ importers: '@automattic/babel-plugin-preserve-i18n': 1.0.0 '@automattic/babel-plugin-replace-textdomain': workspace:^0.1.0 '@automattic/i18n-check-webpack-plugin': workspace:^0.1.1-alpha + '@automattic/i18n-loader-webpack-plugin': workspace:^0.1.0-alpha '@automattic/webpack-rtl-plugin': 5.1.0 '@babel/compat-data': 7.16.4 '@babel/core': 7.16.0 @@ -462,6 +463,7 @@ importers: '@automattic/babel-plugin-preserve-i18n': 1.0.0 '@automattic/babel-plugin-replace-textdomain': link:../babel-plugin-replace-textdomain '@automattic/i18n-check-webpack-plugin': link:../i18n-check-webpack-plugin + '@automattic/i18n-loader-webpack-plugin': link:../i18n-loader-webpack-plugin '@automattic/webpack-rtl-plugin': 5.1.0_webpack@5.64.1 '@babel/compat-data': 7.16.4 '@babel/helper-compilation-targets': 7.16.3_@babel+core@7.16.0 @@ -494,7 +496,7 @@ importers: '@automattic/jetpack-api': workspace:^0.8.0 '@automattic/jetpack-connection': workspace:^0.11.3 '@automattic/jetpack-idc': workspace:^0.7.0 - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@babel/core': 7.16.0 '@babel/preset-env': 7.16.4 '@babel/register': 7.16.0 @@ -534,7 +536,7 @@ importers: projects/packages/identity-crisis: specifiers: - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@babel/core': 7.16.0 '@babel/preset-env': 7.16.4 '@babel/register': 7.16.0 @@ -573,7 +575,7 @@ importers: projects/packages/jitm: specifiers: - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@wordpress/browserslist-config': 4.1.0 sass: 1.43.3 sass-loader: 12.2.0 @@ -589,7 +591,7 @@ importers: projects/packages/lazy-images: specifiers: - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha copy-webpack-plugin: 9.0.1 intersection-observer: 0.12.0 webpack: 5.64.1 @@ -604,7 +606,7 @@ importers: '@automattic/jetpack-base-styles': workspace:^0.1.2 '@automattic/jetpack-components': workspace:^0.9.0 '@automattic/jetpack-connection': workspace:^0.11.3 - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@babel/core': 7.16.0 '@babel/preset-env': 7.16.4 '@babel/register': 7.16.0 @@ -645,7 +647,7 @@ importers: '@automattic/jetpack-analytics': workspace:^0.1.3 '@automattic/jetpack-api': workspace:^0.8.0 '@automattic/jetpack-components': workspace:^0.9.0 - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@babel/core': 7.16.0 '@babel/plugin-proposal-nullish-coalescing-operator': 7.16.0 '@babel/preset-env': 7.16.4 @@ -737,7 +739,7 @@ importers: '@automattic/jetpack-base-styles': workspace:^0.1.2 '@automattic/jetpack-components': workspace:^0.9.0 '@automattic/jetpack-connection': workspace:^0.11.3 - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@babel/core': 7.16.0 '@babel/preset-env': 7.16.4 '@babel/register': 7.16.0 @@ -864,7 +866,7 @@ importers: '@automattic/jetpack-connection': workspace:^0.11.3 '@automattic/jetpack-licensing': workspace:^0.3.2 '@automattic/jetpack-partner-coupon': workspace:^0.1.2 - '@automattic/jetpack-webpack-config': workspace:^0.5.1-alpha + '@automattic/jetpack-webpack-config': workspace:^0.6.0-alpha '@automattic/popup-monitor': 1.0.0 '@automattic/remove-asset-webpack-plugin': workspace:^0.1.1 '@automattic/request-external-access': 1.0.0 diff --git a/projects/js-packages/webpack-config/README.md b/projects/js-packages/webpack-config/README.md index bb408f214f51a..fe185280cdcc0 100644 --- a/projects/js-packages/webpack-config/README.md +++ b/projects/js-packages/webpack-config/README.md @@ -175,6 +175,12 @@ This provides an instance of [duplicate-package-checker-webpack-plugin](https:// This provides an instance of [@wordpress/dependency-extraction-webpack-plugin](https://www.npmjs.com/package/@wordpress/dependency-extraction-webpack-plugin). The `options` are passed to the plugin. +##### `I18nLoaderPlugin( options )` + +This provides an instance of [@automattic/i18n-loader-webpack-plugin](https://www.npmjs.com/package/@automattic/i18n-loader-webpack-plugin). The `options` are passed to the plugin. + +Note that if the plugin actually does anything in your build, you'll need to specify at least the `domain` option for it. + ##### `I18nCheckPlugin( options )` This provides an instance of [@wordpress/i18n-check-webpack-plugin](https://www.npmjs.com/package/@wordpress/i18n-check-webpack-plugin). The `options` are passed to the plugin. diff --git a/projects/js-packages/webpack-config/changelog/add-use-i18n-loader-webpack-plugin b/projects/js-packages/webpack-config/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..f409adae5f53a --- /dev/null +++ b/projects/js-packages/webpack-config/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: major +Type: added + +Add `@automattic/i18n-loader-webpack-plugin`. This may break some builds. diff --git a/projects/js-packages/webpack-config/package.json b/projects/js-packages/webpack-config/package.json index cff3ae36d0ef9..2777f62e829ef 100644 --- a/projects/js-packages/webpack-config/package.json +++ b/projects/js-packages/webpack-config/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-webpack-config", - "version": "0.5.1-alpha", + "version": "0.6.0-alpha", "description": "Library of pieces for webpack config in Jetpack projects.", "homepage": "https://jetpack.com", "bugs": { @@ -20,6 +20,7 @@ "@automattic/babel-plugin-preserve-i18n": "1.0.0", "@automattic/babel-plugin-replace-textdomain": "workspace:^0.1.0", "@automattic/i18n-check-webpack-plugin": "workspace:^0.1.1-alpha", + "@automattic/i18n-loader-webpack-plugin": "workspace:^0.1.0-alpha", "@automattic/webpack-rtl-plugin": "5.1.0", "@babel/compat-data": "7.16.4", "@babel/helper-compilation-targets": "7.16.3", diff --git a/projects/js-packages/webpack-config/src/webpack.js b/projects/js-packages/webpack-config/src/webpack.js index c1166af071735..d8ff4c84829d0 100644 --- a/projects/js-packages/webpack-config/src/webpack.js +++ b/projects/js-packages/webpack-config/src/webpack.js @@ -7,6 +7,7 @@ const DuplicatePackageCheckerWebpackPlugin = require( 'duplicate-package-checker const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' ); const MiniCSSWithRTLPlugin = require( './webpack/mini-css-with-rtl' ); const WebpackRTLPlugin = require( '@automattic/webpack-rtl-plugin' ); +const I18nLoaderWebpackPlugin = require( '@automattic/i18n-loader-webpack-plugin' ); const I18nCheckWebpackPlugin = require( '@automattic/i18n-check-webpack-plugin' ); const MyCssMinimizerPlugin = options => new CssMinimizerPlugin( options ); @@ -66,6 +67,8 @@ const DuplicatePackageCheckerPlugin = options => [ const DependencyExtractionPlugin = options => [ new DependencyExtractionWebpackPlugin( options ) ]; +const I18nLoaderPlugin = options => [ new I18nLoaderWebpackPlugin( options ) ]; + const i18nFilterFunction = file => { if ( ! /\.(?:jsx?|tsx?|cjs|mjs|svelte)$/.test( file ) ) { return false; @@ -101,6 +104,7 @@ const StandardPlugins = ( options = {} ) => { ...( options.DependencyExtractionPlugin === false ? [] : DependencyExtractionPlugin( options.DependencyExtractionPlugin ) ), + ...( options.I18nLoaderPlugin === false ? [] : I18nLoaderPlugin( options.I18nLoaderPlugin ) ), ...( options.I18nCheckPlugin === false ? [] : I18nCheckPlugin( options.I18nCheckPlugin ) ), ]; }; @@ -135,6 +139,7 @@ module.exports = { WebpackRtlPlugin: MyWebpackRtlPlugin, DependencyExtractionPlugin, DuplicatePackageCheckerPlugin, + I18nLoaderPlugin, // Module rules and loaders. TranspileRule, CssRule, diff --git a/projects/packages/connection-ui/changelog/add-use-i18n-loader-webpack-plugin b/projects/packages/connection-ui/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/connection-ui/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/connection-ui/package.json b/projects/packages/connection-ui/package.json index f9f36b108a764..1e30362e6a8ae 100644 --- a/projects/packages/connection-ui/package.json +++ b/projects/packages/connection-ui/package.json @@ -22,7 +22,7 @@ "@wordpress/data": "6.1.4" }, "devDependencies": { - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@babel/core": "7.16.0", "@babel/preset-env": "7.16.4", "@babel/register": "7.16.0", diff --git a/projects/packages/identity-crisis/changelog/add-use-i18n-loader-webpack-plugin b/projects/packages/identity-crisis/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/identity-crisis/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/identity-crisis/package.json b/projects/packages/identity-crisis/package.json index e26abfc974b63..0c4c0301f7acf 100644 --- a/projects/packages/identity-crisis/package.json +++ b/projects/packages/identity-crisis/package.json @@ -19,7 +19,7 @@ "@wordpress/data": "6.1.4" }, "devDependencies": { - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@babel/core": "7.16.0", "@babel/preset-env": "7.16.4", "@babel/register": "7.16.0", diff --git a/projects/packages/jitm/changelog/add-use-i18n-loader-webpack-plugin b/projects/packages/jitm/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/jitm/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/jitm/package.json b/projects/packages/jitm/package.json index 311d3cf4e8281..2b95f5f130656 100644 --- a/projects/packages/jitm/package.json +++ b/projects/packages/jitm/package.json @@ -24,7 +24,7 @@ }, "browserslist": "extends @wordpress/browserslist-config", "devDependencies": { - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@wordpress/browserslist-config": "4.1.0", "sass": "1.43.3", "sass-loader": "12.2.0", diff --git a/projects/packages/lazy-images/changelog/add-use-i18n-loader-webpack-plugin b/projects/packages/lazy-images/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/lazy-images/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/lazy-images/package.json b/projects/packages/lazy-images/package.json index 4deaf62bffbc1..67750101bcda6 100644 --- a/projects/packages/lazy-images/package.json +++ b/projects/packages/lazy-images/package.json @@ -25,7 +25,7 @@ "validate": "pnpm exec validate-es dist/" }, "devDependencies": { - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "copy-webpack-plugin": "9.0.1", "intersection-observer": "0.12.0", "webpack": "5.64.1" diff --git a/projects/packages/my-jetpack/changelog/add-use-i18n-loader-webpack-plugin b/projects/packages/my-jetpack/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index 08b38571883bb..4cb37527e8bef 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -32,7 +32,7 @@ ], "devDependencies": { "@automattic/jetpack-base-styles": "workspace:^0.1.2", - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@babel/core": "7.16.0", "@babel/preset-env": "7.16.4", "@babel/register": "7.16.0", diff --git a/projects/packages/search/changelog/add-use-i18n-loader-webpack-plugin b/projects/packages/search/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/search/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/search/package.json b/projects/packages/search/package.json index 8aad30a3e4c9f..97d1116a6d874 100644 --- a/projects/packages/search/package.json +++ b/projects/packages/search/package.json @@ -65,7 +65,7 @@ "tiny-lru": "7.0.6" }, "devDependencies": { - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@babel/core": "7.16.0", "@babel/plugin-proposal-nullish-coalescing-operator": "7.16.0", "@babel/preset-env": "7.16.4", diff --git a/projects/plugins/backup/changelog/add-use-i18n-loader-webpack-plugin b/projects/plugins/backup/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/plugins/backup/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/plugins/backup/package.json b/projects/plugins/backup/package.json index 9f9bb5c5109fa..f396dfdd37f20 100644 --- a/projects/plugins/backup/package.json +++ b/projects/plugins/backup/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "@automattic/jetpack-base-styles": "workspace:^0.1.2", - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@babel/core": "7.16.0", "@babel/preset-env": "7.16.4", "@babel/register": "7.16.0", diff --git a/projects/plugins/jetpack/changelog/add-use-i18n-loader-webpack-plugin b/projects/plugins/jetpack/changelog/add-use-i18n-loader-webpack-plugin new file mode 100644 index 0000000000000..754c9ef3e1cfa --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-use-i18n-loader-webpack-plugin @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Use `@automattic/i18n-loader-webpack-plugin` to remove the hack for Instant Search's lazy-loaded bundle. diff --git a/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php b/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php index 68bd0b113a951..afe391e9ff279 100644 --- a/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php +++ b/projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php @@ -130,35 +130,6 @@ public function load_assets_with_parameters( $path_prefix, $plugin_base_path ) { Assets::enqueue_script( 'jetpack-instant-search' ); $this->load_and_initialize_tracks(); $this->inject_javascript_options(); - - // It only inlines the translations for the script, but does not actually load the script. - $this->inject_translation_for_script( - plugins_url( - $path_prefix . '_inc/build/instant-search/jp-search.chunk-main-payload.js', - $plugin_base_path - ) - ); - } - - /** - * Add inline translations for script `$payload_url` before loading `$before_handle` script. - * - * @param string $payload_url - The payload url for which we load the translations. - * @param string $before_handle - Inline the translations before this handle. - */ - protected function inject_translation_for_script( $payload_url, $before_handle = 'jetpack-instant-search' ) { - // Set a random name for the script. - $handle = 'jetpack-instant-search-' . wp_unique_id(); - // Then register it, which is required for the next steps. - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion - wp_register_script( $handle, $payload_url, array(), false, false ); - // Set translation domain to `jetpack`, and we need to explicitly set the `path` to load translations files for WPCOM. - // Otherwise WPCOM would try to load from `WP_LANG_DIR . '/mu-plugins'` and fails. - wp_set_script_translations( $handle, 'jetpack', WP_LANG_DIR . '/plugins' ); - // Inline the translations before `$before_handle` handle. - wp_add_inline_script( $before_handle, wp_scripts()->print_translations( $handle, false ), 'before' ); - // Deregister the script as we don't really enqueue it from PHP side. - wp_deregister_script( $handle ); } /** diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 894f1174c7233..e62d4ece1d2a1 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -150,7 +150,7 @@ "devDependencies": { "@automattic/color-studio": "2.5.0", "@automattic/jetpack-base-styles": "workspace:^0.1.2", - "@automattic/jetpack-webpack-config": "workspace:^0.5.1-alpha", + "@automattic/jetpack-webpack-config": "workspace:^0.6.0-alpha", "@automattic/remove-asset-webpack-plugin": "workspace:^0.1.1", "@babel/core": "7.16.0", "@babel/plugin-proposal-nullish-coalescing-operator": "7.16.0", diff --git a/projects/plugins/jetpack/tools/webpack.config.extensions.js b/projects/plugins/jetpack/tools/webpack.config.extensions.js index 76c2827267ce7..fe43811280d59 100644 --- a/projects/plugins/jetpack/tools/webpack.config.extensions.js +++ b/projects/plugins/jetpack/tools/webpack.config.extensions.js @@ -200,6 +200,7 @@ module.exports = [ plugins: [ ...jetpackWebpackConfig.StandardPlugins( { DependencyExtractionPlugin: false, + I18nLoaderPlugin: false, I18nCheckPlugin: false, } ), new webpack.NormalModuleReplacementPlugin( diff --git a/projects/plugins/jetpack/tools/webpack.config.js b/projects/plugins/jetpack/tools/webpack.config.js index 7f27f047d1638..73dc1a0cf64fd 100644 --- a/projects/plugins/jetpack/tools/webpack.config.js +++ b/projects/plugins/jetpack/tools/webpack.config.js @@ -173,6 +173,7 @@ module.exports = [ plugins: [ ...jetpackWebpackConfig.StandardPlugins( { DependencyExtractionPlugin: false, + I18nLoaderPlugin: false, I18nCheckPlugin: false, } ), new StaticSiteGeneratorPlugin( { diff --git a/projects/plugins/jetpack/tools/webpack.config.search-configure.js b/projects/plugins/jetpack/tools/webpack.config.search-configure.js index d8a8cb8a0198a..b3074cd401df2 100644 --- a/projects/plugins/jetpack/tools/webpack.config.search-configure.js +++ b/projects/plugins/jetpack/tools/webpack.config.search-configure.js @@ -32,6 +32,7 @@ module.exports = { plugins: [ ...jetpackWebpackConfig.StandardPlugins( { DependencyExtractionPlugin: { injectPolyfill: true }, + I18nLoaderPlugin: { textdomain: 'jetpack' }, } ), definePaletteColorsAsStaticVariables(), ], diff --git a/projects/plugins/jetpack/tools/webpack.config.search.js b/projects/plugins/jetpack/tools/webpack.config.search.js index 90d131ff670d3..85776eb79c44c 100644 --- a/projects/plugins/jetpack/tools/webpack.config.search.js +++ b/projects/plugins/jetpack/tools/webpack.config.search.js @@ -65,6 +65,7 @@ module.exports = { requestToExternal, requestToHandle: defaultRequestToHandle, }, + I18nLoaderPlugin: { textdomain: 'jetpack' }, } ), // Replace 'debug' module with a dummy implementation in production ...( jetpackWebpackConfig.isDevelopment diff --git a/projects/plugins/jetpack/tools/webpack.config.widget-visibility.js b/projects/plugins/jetpack/tools/webpack.config.widget-visibility.js index 119482c08a9c9..55a582157c6b8 100644 --- a/projects/plugins/jetpack/tools/webpack.config.widget-visibility.js +++ b/projects/plugins/jetpack/tools/webpack.config.widget-visibility.js @@ -40,6 +40,7 @@ module.exports = { plugins: [ ...jetpackWebpackConfig.StandardPlugins( { DependencyExtractionPlugin: { injectPolyfill: true }, + I18nLoaderPlugin: { textdomain: 'jetpack' }, } ), definePaletteColorsAsStaticVariables(), ],