選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

NodeMainTemplateAsync.runtime.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. /*global installedChunks $hotChunkFilename$ $require$ hotAddUpdateChunk $hotMainFilename$ */
  6. module.exports = function() {
  7. // eslint-disable-next-line no-unused-vars
  8. function hotDownloadUpdateChunk(chunkId) {
  9. var filename = require("path").join(__dirname, $hotChunkFilename$);
  10. require("fs").readFile(filename, "utf-8", function(err, content) {
  11. if (err) {
  12. if ($require$.onError) return $require$.oe(err);
  13. throw err;
  14. }
  15. var chunk = {};
  16. require("vm").runInThisContext(
  17. "(function(exports) {" + content + "\n})",
  18. { filename: filename }
  19. )(chunk);
  20. hotAddUpdateChunk(chunk.id, chunk.modules);
  21. });
  22. }
  23. // eslint-disable-next-line no-unused-vars
  24. function hotDownloadManifest() {
  25. var filename = require("path").join(__dirname, $hotMainFilename$);
  26. return new Promise(function(resolve, reject) {
  27. require("fs").readFile(filename, "utf-8", function(err, content) {
  28. if (err) return resolve();
  29. try {
  30. var update = JSON.parse(content);
  31. } catch (e) {
  32. return reject(e);
  33. }
  34. resolve(update);
  35. });
  36. });
  37. }
  38. // eslint-disable-next-line no-unused-vars
  39. function hotDisposeChunk(chunkId) {
  40. delete installedChunks[chunkId];
  41. }
  42. };