function createExternalImports (chunk, outputOptions, externalImports) {
    let output = '';
    let { format, globals } = outputOptions;

    output += externalImports.map(ei => {
        let name = ei.source.replace(/[\W]/g, '_');
        let { source, specifiers } = ei;

        // Bare external import
        if (specifiers.length === 0) {
            if (format === 'es') 
                return `import '${source}';`
            if (format === 'cjs' || format === 'amd') 
                return `require('${source}');`
        }


        let iifeName = format === 'iife'? (globals[source] || getIIFEName(ei)) : '';

        return specifiers.map(s => {

            if (s.imported === '*') {
                if (format === 'es') 
                    return `import * as __nollup__external__${name}__ from '${source}';`;
                if (format === 'cjs' || format === 'amd') 
                    return `var __nollup__external__${name}__ = require('${source}');`;
                if (format === 'iife') 
                    return `var __nollup__external__${name}__ = self.${iifeName};`
            }

            if (s.imported === 'default') {
                if (format === 'es') 
                    return `import __nollup__external__${name}__default__ from '${source}';`;
                if (format === 'cjs' || format === 'amd') 
                    return `var __nollup__external__${name}__default__ = require('${source}').hasOwnProperty('default')? require('${source}').default : require('${source}');`
                if (format === 'iife') 
                    return `var __nollup__external__${name}__default__ = self.${iifeName} && self.${iifeName}.hasOwnProperty('default')? self.${iifeName}.default : self.${iifeName};`
            }

            if (format === 'es') 
                return `import { ${s.imported} as __nollup__external__${name}__${s.imported}__ } from '${source}';`;
            if (format === 'cjs' || format === 'amd') 
                return `var __nollup__external__${name}__${s.imported}__ = require('${source}').${s.imported};`
            if (format === 'iife') 
                return `var __nollup__external__${name}__${s.imported}__ = self.${iifeName}.${s.imported};`
        }).join('\n');
    }).join('\n');

    return output;
}
@param {RollupRenderedChunk} chunk 
@param {RollupOutputOptions} outputOptions 
@param {Array<NollupInternalModuleImport>} externalImports
@return {string}