![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
babel-plugin-react-create-element-alias
Advanced tools
A babel plugin to change React.createElement to an alias (_rce or other unique variable based on scope) so that it can be better handled in obfuscation (without object property mangling).
A babel plugin to change React.createElement to an alias (_rce or other unique variable based on scope) so that it can be better handled in obfuscation (without object property mangling).
npm install --save-dev babel-plugin-react-create-element-alias
Add it to your bablerc
{
"presets": ["react", "es2015"],
"plugins": ["babel-plugin-react-create-element-alias"]
}
Before Transpile
import React from 'react';
function SampleComponent(props) {
const {name} = props;
return (
<div className="wrapper">
<span className="name">{name}</span>
</div>
)
}
After Transpile
"use strict";
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _rce = _react2.default.createElement;
function SampleComponent(props) {
var name = props.name;
return _rce(
"div",
{ className: "wrapper" },
_rce(
"span",
{ className: "name" },
name
)
);
}
I worked on this project to experiment with scope and bindings in babel plugin and later thought to open source it. Most of the time you may not need this plugin.
If you are using gzip / brotli / zopfli compression (which you always should). You might not see a significant reduction in compressed bundle size it may vary from bytes to few kbs. So you should test it before you finalize using it.
You may be using transform-react-jsx pragma if you have different method to handle creating element like in preact its h. You don't need this. But do note defining pragma does not add declaration of you pragma function in your file. for example it will not add import React, {createElement as rce} from 'react'
or const _rce = React.createElement
.
If you can mangle property with regex for createElement you will not need this.
FAQs
A babel plugin to change React.createElement to an alias (_rce or other unique variable based on scope) so that it can be better handled in obfuscation (without object property mangling).
The npm package babel-plugin-react-create-element-alias receives a total of 0 weekly downloads. As such, babel-plugin-react-create-element-alias popularity was classified as not popular.
We found that babel-plugin-react-create-element-alias demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.