Skip to content

Instantly share code, notes, and snippets.

@chitoku-k
Created December 12, 2018 19:07
Show Gist options
  • Save chitoku-k/90a5d98e4d3d7fbb065e9fb24769b6b5 to your computer and use it in GitHub Desktop.
Save chitoku-k/90a5d98e4d3d7fbb065e9fb24769b6b5 to your computer and use it in GitHub Desktop.
Component loading through text template
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