How to use requirefresh - 2 common examples

To help you get started, we’ve selected a few requirefresh 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 donskov / static-render-html-webpack-plugin / src / index.js View on Github external
return callback();
        }

        let fileExtension = entry.split('.');
        fileExtension = `.${fileExtension[fileExtension.length - 1]}`;

        const FILE_SUPPORT_REGEXP = /.(js|jsx)$/g;
        if (!FILE_SUPPORT_REGEXP.test(fileExtension)) {
          compilation.errors.push(
            prettyError.fileExtension(entry, compiler.context),
          );
          return callback();
        }

        try {
          result = requirefresh(entry);
        } catch (error) {
          compilation.errors.push(prettyError.errorWrapper(error));
          return callback();
        }

        compilation.fileDependencies.add(entry);

        if (result.default && typeof result.default === 'object') {
          result = result.default;
        }

        Object.keys(result).forEach((key) => {
          let renderedStaticMarkup = '';

          try {
            renderedStaticMarkup = `${renderToStaticMarkup(
github nfriedly / nfriedly.com / node_modules / docpad / node_modules / cson / out / lib / cson.js View on Github external
(function() {
  var CSON, ambi, coffee, extractOpts, fsUtil, isJsOrCoffee, isJsonOrCson, js2coffee, pathUtil, requireFreshSafe, wait;

  coffee = require('coffee-script');

  js2coffee = require('js2coffee');

  fsUtil = require('fs');

  pathUtil = require('path');

  ambi = require('ambi');

  extractOpts = require('extract-opts').extractOpts;

  requireFreshSafe = require('requirefresh').requireFreshSafe;

  require('coffee-script/register');

  wait = function(delay, fn) {
    return setTimeout(fn, delay);
  };

  isJsOrCoffee = function(filePath) {
    return /\.(js|coffee)$/.test(filePath);
  };

  isJsonOrCson = function(filePath) {
    return /\.(json|cson)$/.test(filePath);
  };

  CSON = {

requirefresh

Require a file without adding it into the require cache

Artistic-2.0
Latest version published 11 months ago

Package Health Score

68 / 100
Full package analysis

Popular requirefresh functions