How to use the @open-wc/building-utils/index-html.findInlineEntryId function in @open-wc/building-utils

To help you get started, we’ve selected a few @open-wc/building-utils 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 open-wc / open-wc / packages / rollup-plugin-index-html / rollup-plugin-index-html.js View on Github external
load(id) {
      const inlineEntryId = findInlineEntryId(id);
      // if this is an inline entry, take the inline module index from the import and return it's content
      if (typeof inlineEntryId === 'number') {
        return inlineModules[inlineEntryId];
      }

      // defer loading to other plugins / rollup
      return null;
    },
github open-wc / open-wc / packages / rollup-plugin-index-html / rollup-plugin-index-html.js View on Github external
resolveId(source, importer) {
      // if this is an inline entry keep it, load() will take ca,re of it
      if (typeof findInlineEntryId(source) === 'number') {
        return source;
      }

      if (Array.isArray(inlineImportMaps) && inlineImportMaps.length > 0) {
        // exclude entry points as they may get provided as `main.js` without a path
        // which would be considered bare module according to import map spec
        if (
          rollupOptions.input &&
          Array.isArray(rollupOptions.input) &&
          rollupOptions.input.includes(source)
        ) {
          return null;
        }
        const { rootDir = process.cwd() } = localPluginConfig;

        const basePath = importer ? importer.replace(rootDir, `${rootDir}::`) : `${rootDir}::`;