// Called only in Node.js branches. An indirect import keeps native Node modules // out of browser bundles without making bundlers resolve a variable import. export const importNodeModule = (specifier: string): Promise => { // eslint-disable-next-line no-new-func const dynamicImport = new Function( 'specifier', 'return import(specifier)', ) as (module: string) => Promise; return dynamicImport(specifier); };