Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !8848

Optimize React.createElement property accesses

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/NeoLegends/fix/create-element into main Apr 17, 2020
  • Overview 4
  • Commits 1
  • Pipelines 1
  • Changes 3

Created by: NeoLegends

This PR fixes https://github.com/facebook/create-react-app/issues/5435 and addresses https://github.com/facebook/create-react-app/pull/6219#issuecomment-613932332 by employing a new Babel plugin that replaces calls to React.createElement with calls to a local variable that is bound to React.createElement.

Originally I aimed for a babel plugin implementation that makes use of JSX pragmas to instruct the translator to use the local variable. That did not work out in the context of CRA, so the current implementation is based on what was proposed in https://github.com/facebook/create-react-app/pull/6219.

Right now, the plugin lives in my GitHub profile at https://github.com/NeoLegends/babel-plugin-transform-react-create-element. If desired, I'll happily transfer ownership of the code and the npm package here and remove the usage of TypeScript.

I tested the changes using yarn build, inspecting the build output and verifying things work in the browser. The babel plugin itself also features tests.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/NeoLegends/fix/create-element