How to use the hops-config.workerFile function in hops-config

To help you get started, we’ve selected a few hops-config 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 xing / hops / packages / build-config / plugins / service-worker.js View on Github external
this.apply = function(compiler) {
    if (!hopsConfig.workerFile) {
      return;
    }

    function onMake(compilation, callback) {
      compilation
        .createChildCompiler(PLUGIN_NAME, { filename: assetPath }, [
          new SingleEntryPlugin(
            compiler.context,
            require.resolve('../shims/worker-shim'),
            'worker'
          ),
        ])
        .runAsChild(callback);
    }

    function onEmit(compilation, callback) {
github xing / hops / packages / build-config / sections / resolve.js View on Github external
module.exports = function getResolveConfig(target) {
  var platform = target === 'node' ? 'server' : 'browser';
  return {
    alias: Object.assign(
      {
        'hops-entry-point': hopsConfig.appDir,
      },
      hopsConfig.workerFile && {
        'hops-worker-entry-point': hopsConfig.workerFile,
      }
    ),
    mainFields: [
      'esnext:' + platform,
      'jsnext:' + platform,
      platform,
      'esnext',
      'jsnext',
      'esnext:main',
      'jsnext:main',
      'main',
    ],
    modules: ['node_modules'].concat(hopsConfig.moduleDirs),
    extensions: ['.js', '.jsx'],
  };
};
github xing / hops / packages / build-config / sections / resolve.js View on Github external
module.exports = function getResolveConfig(target) {
  var platform = target === 'node' ? 'server' : 'browser';
  return {
    alias: Object.assign(
      {
        'hops-entry-point': hopsConfig.appDir,
      },
      hopsConfig.workerFile && {
        'hops-worker-entry-point': hopsConfig.workerFile,
      }
    ),
    mainFields: [
      'esnext:' + platform,
      'jsnext:' + platform,
      platform,
      'esnext',
      'jsnext',
      'esnext:main',
      'jsnext:main',
      'main',
    ],
    modules: ['node_modules'].concat(hopsConfig.moduleDirs),
    extensions: ['.js', '.jsx'],
  };