Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
After rollup is packaged (the product is in UMD format), the static properties of the component are lost

let's say I have a component

import React, { createElement } from 'react';
import C from './C'
function A(){
  console.log(111)
  console.log(C)
  // return <div>111</div>
}
A.a=1111;
export default A

Rollup packaging results in a RUNtime.js file in UMD format

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
  typeof define === 'function' && define.amd ? define(['react'], factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.rootcloud = global.rootcloud || {}, global.rootcloud.RootcloudBar = global.rootcloud.RootcloudBar || {}, global.rootcloud.RootcloudBar.runtime = factory(global.React)));
})(this, (function (react) { 'use strict';

  function A() {
    return /* @__PURE__ */ react.createElement("div", null, "111");
  }
  A.a = 1111;

  var __defProp = Object.defineProperty;
  var __defProps = Object.defineProperties;
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __spreadValues = (a, b) => {
    for (var prop in b || (b = {}))
      if (__hasOwnProp.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    if (__getOwnPropSymbols)
      for (var prop of __getOwnPropSymbols(b)) {
        if (__propIsEnum.call(b, prop))
          __defNormalProp(a, prop, b[prop]);
      }
    return a;
  };
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
  const Index = (props) => {
    return /* @__PURE__ */ react.createElement(A, __spreadProps(__spreadValues({}, props), {
      reversal: false
    }));
  };

  return Index;

}));

When I import runtime.js to a component, I found that there was no A property on the component

import ShowCompoment from './runtime'
console.log(ShowCompoment.a) // undefined

What should I do to access the A property on the component?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!