SHARE
TWEET

Untitled

a guest Mar 20th, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Original:
  2. import("module/id").then(...);
  3.  
  4. // Node.js (synchronous require; easy):
  5. Promise.resolve().then(_ => require("module/id")).then(...);
  6.  
  7. // AMD (async require; non-standard):
  8. new Promise(resolve => require("module/id", resolve)).then(...);
  9.  
  10. // Webpack 2 (require.ensure is Webpack-specific):
  11. new Promise(resolve => {
  12.   require.ensure(["module/id"], require => {
  13.     resolve(require("module/id"));
  14.   });
  15. }).then(...);
  16.  
  17. // Meteor 1.5:
  18. module.dynamicImport("module/id").then(…);
RAW Paste Data
Top