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

Calypso Build: babel-plugin-optimize-i18n misses some spots #50366

Open
mirka opened this issue Feb 23, 2021 · 0 comments
Open

Calypso Build: babel-plugin-optimize-i18n misses some spots #50366

mirka opened this issue Feb 23, 2021 · 0 comments
Labels
[Type] Bug [Type] Tooling Related to tools, scripts, automation, DevX, etc.

Comments

@mirka
Copy link
Member

mirka commented Feb 23, 2021

Overview

The i18n unmangling plugin added in #49341 seems to not be working in certain places.

While it works in most cases, it can still output functions like (0, l.__)("my string", "my-domain").

Context

I first encountered this issue when trying to integrate the update into P2 Blocks (2070-gh-Automattic/p2), where for some reason it fails in a lot of places.

I was able to observe it happening here in this repo as well:

  1. Build the ETK editor-site-launch module.

    $ cd apps/editing-toolkit
    $ yarn build:editor-site-launch
  2. Look at the dist files for focused-launch.js and gutenboarding-launch.js, and search for the string __)(. You should find a mangled i18n call: (0,r.__)("Site Title","full-site-editing").

I couldn't determine what the exact cause was, but I'm wondering if it is a Babel preset/plugin order issue. Because at least for the code in P2 Blocks, some of the instances are fixed if I invert the preset order here:

presets = [
path.join( __dirname, 'babel', 'default' ),
env.WP && path.join( __dirname, 'babel', 'wordpress-element' ),

  • yarn version: 1.22.10

cc: @jsnajdr

@mirka mirka added [Type] Bug [Type] Tooling Related to tools, scripts, automation, DevX, etc. labels Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug [Type] Tooling Related to tools, scripts, automation, DevX, etc.
Projects
None yet
Development

No branches or pull requests

1 participant