How to use the react-refresh/runtime.createSignatureFunctionForTransform function in react-refresh

To help you get started, we’ve selected a few react-refresh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pmmmwh / react-refresh-webpack-plugin / src / runtime / ReactRefreshEntry.js View on Github external
/**
     * Registers a refresh to react-refresh.
     * @param {string} [type] A valid type of a module.
     * @param {number} [id] An ID of a module.
     * @returns {void}
     */
    window.$RefreshReg$ = function(type, id) {
      const typeId = moduleId + ' ' + id;
      Refresh.register(type, typeId);
    };

    /**
     * Creates a module signature function from react-refresh.
     * @returns {function(string): string} A created signature function.
     */
    window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;

    // Restore to previous refresh functions after initialization
    return function cleanup() {
      window.$RefreshReg$ = prevRefreshReg;
      window.$RefreshSig$ = prevRefreshSig;
    };
  };
}
github parcel-bundler / parcel / packages / transformers / react-refresh-wrap / src / helpers / helpers.js View on Github external
module.exports.prelude = function(module) {
  window.$RefreshReg$ = function(type, id) {
    Refresh.register(type, module.id + ' ' + id);
  };
  window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
};