UNPKG

async-usage

Version:

Declarative dynamic imports for everyone!

14 lines 696 B
import { chunkGeneratorFactory } from './generate-chunk'; export function chunkImporterFactory(importFactory, basePath, plugins = []) { const generateChunk = chunkGeneratorFactory(importFactory, plugins); return function chunkImporter(name, relativePath) { const generate = generateChunk(name); if (!relativePath) { return generate(basePath + '/' + name); } const normalizedPath = relativePath.replace(/\\/g, '/'); const sourceless = normalizedPath.startsWith('src/') ? normalizedPath.replace('src/', '') : normalizedPath; return generate(sourceless + '/' + name); }; } //# sourceMappingURL=chunk-factory.js.map