<div dir="ltr">Syntax:<br><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">try import fs from 'fs'</span></div><div><span style="font-family:monospace,monospace">   else import fs from 'fs-polyfill'</span></div><div><span style="font-family:monospace,monospace">   else import fs from 'another-fs-polyfill'</span></div><div><span style="font-family:monospace,monospace">   else do nothing; // Not sure about syntax</span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">try import {watchDirectory} from 'fs'</span></div><div><span style="font-family:monospace,monospace">   else import <span style="font-family:monospace,monospace">{watchDirectory}</span> from 'fs-polyfill'</span></div><div><span style="font-family:monospace,monospace">   else if(process.os === 'ExoticSystem') import <span style="font-family:monospace,monospace">{watchDirectory}</span> from 'another-fs-polyfill'</span></div><div><span style="font-family:monospace,monospace">   else throw Error('Your OS doesn\'t support watching directories');<br></span></div><span style="font-family:monospace,monospace"></span></div><div><br></div><div>Usages:</div><div><ul><li>Optional dependencies</li><li>Polyfills</li></ul><div>Problems:<br><ul><li>This can prevent loading modules before execution if presence of modules can't be proved statically</li><li>else-if requires execution before loading module - can be dropped</li></ul></div></div><div><br></div><div>I don't have enough time and knowledge about modules to write actual proposal.<br></div></div>