message: refactor(webpack-entry): switch to async execution
diff: @@ -3,21 +3,29 @@ const commonDir = require("common-dir");
  const globby = require("globby");
  const utils = require("loader-utils");
  -module.exports = function webpackEntry() {
  +module.exports = async function webpackEntry() {
  + const cb = this.async();
  const options = utils.getOptions(this);
  - const cwd = options.cwd || process.cwd();
  - const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
  - const files = globby.sync(entries, {cwd});
  - const dir = commonDir(files);
  +
  + const files = await getFiles(options)
  if (files.length > 0) {
  + const dir = commonDir(files);
  this.addContextDependency(dir);
  }
  - return `
  + const result = `
  if (module.hot) {
  module.hot.accept([]);
  }
  ${files.map(file => `module.exports['${file}'] = require('./${file}');`).join('\n')}
  `;
  +
  + cb(null, result);
  };
  +
  +function getFiles(options) {
  + const entries = Array.isArray(options.entry) ? options.entry : [options.entry];
  + const cwd = options.cwd || process.cwd();
  + return globby(entries, {cwd});
  +}
  