Created
December 12, 2018 19:07
-
-
Save chitoku-k/90a5d98e4d3d7fbb065e9fb24769b6b5 to your computer and use it in GitHub Desktop.
Component loading through text template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define('sample.vue', [], '<template></template>'); | |
httpVueLoader._httpRequest = httpVueLoader.httpRequest; | |
httpVueLoader.httpRequest = function (url) { | |
if (!require.defined(url)) { | |
return httpVueLoader._httpRequest.apply(this, arguments); | |
} | |
new Promise(function (resolve, reject) { | |
require([ url ], function (template) { | |
resolve(template); | |
}, function () { | |
reject(); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment