How to use the @import-maps/resolve.resolve function in @import-maps/resolve

To help you get started, we’ve selected a few @import-maps/resolve 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
rollupOptions.input.includes(source)
        ) {
          return null;
        }
        const { rootDir = process.cwd() } = localPluginConfig;

        const basePath = importer ? importer.replace(rootDir, `${rootDir}::`) : `${rootDir}::`;
        if (importMapCache === null) {
          inlineImportMaps.forEach(importMapString => {
            const newImportMap = parseFromString(importMapString, basePath);
            importMapCache = mergeImportMaps(importMapCache, newImportMap);
          });
        }

        const relativeSource = source.replace(rootDir, '');
        const resolvedPath = resolve(relativeSource, importMapCache, basePath);

        if (resolvedPath) {
          return resolvedPath;
        }
      }

      return null;
    },

@import-maps/resolve

Parse and resolve imports via an import map

MIT
Latest version published 2 years ago

Package Health Score

80 / 100
Full package analysis