How to use the @parcel/scope-hoisting.concat function in @parcel/scope-hoisting

To help you get started, we’ve selected a few @parcel/scope-hoisting 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 parcel-bundler / parcel / packages / packagers / js / src / JSPackager.js View on Github external
return replaceBundleReferences({
        bundle,
        bundleGraph,
        contents,
        getInlineReplacement: (dependency, inlineType, content) => ({
          from: `"${dependency.id}"`,
          to: inlineType === 'string' ? JSON.stringify(content) : content,
        }),
        getInlineBundleContents,
        map,
      });
    }

    // If scope hoisting is enabled, we use a different code path.
    if (options.scopeHoist) {
      let ast = await concat(bundle, bundleGraph);
      ast = link({bundle, bundleGraph, ast, options});
      return replaceReferences({
        contents: generate(bundleGraph, bundle, ast, options).contents,
        map: null,
      });
    }

    if (bundle.env.outputFormat === 'esmodule') {
      throw new Error(
        `esmodule output is not supported without scope hoisting.`,
      );
    }

    // For development, we just concatenate all of the code together
    // rather then enabling scope hoisting, which would be too slow.
    let codeQueue = new PromiseQueue({maxConcurrent: 32});

@parcel/scope-hoisting

Blazing fast, zero configuration web application bundler

MIT
Latest version published 4 years ago

Package Health Score

72 / 100
Full package analysis

Similar packages