Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

248
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda