webpack#ExternalModule TypeScript Examples

The following examples show how to use webpack#ExternalModule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: pack-external-module.ts    From malagu with MIT License 6 votes vote down vote up
function getExternalModules(stats: Stats | undefined): any[] {
    if (!stats?.compilation.chunks) {
        return [];
    }
    const externals = new Set();
    for (const chunk of stats.compilation.chunks) {
        const modules = stats.compilation.chunkGraph.getChunkModules(chunk);
        if (!modules) {
            continue;
        }

        // Explore each module within the chunk (built inputs):
        for (const module of modules) {
            if (isExternalModule(module)) {
                externals.add({
                    origin: get(findExternalOrigin(stats, stats.compilation.moduleGraph.getIssuer(module)), 'rawRequest'),
                    external: getExternalModuleName(module as ExternalModule)
                });
            }
        }
    }
    return Array.from(externals);
}
Example #2
Source File: pack-external-module.ts    From malagu with MIT License 5 votes vote down vote up
function getExternalModuleName(module: ExternalModule): string {
    return module.userRequest ;
}
Example #3
Source File: pack-external-module.ts    From malagu with MIT License 5 votes vote down vote up
function isExternalModule(module: Module): boolean {
    return module.identifier().startsWith('external ') && !isBuiltinModule(getExternalModuleName(module as ExternalModule));
}