Skip to content

Commit

Permalink
Convert to async loader
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 16, 2021
1 parent 98d1d77 commit 3f9b279
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/packages/demo-loader/demo-loader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fse = require('fs-extra');
const { promises: fs } = require('fs');
const path = require('path');

// FIXME: convert to async
// TODO: convert parseMarkdown to loader

/**
Expand All @@ -28,9 +27,9 @@ function keyToJSIdentifier(key) {
/**
* @type {import('webpack').loader.Loader}
*/
module.exports = function demoLoader() {
module.exports = async function demoLoader() {
const pageFilename = this.context.replace(this.rootContext, '').replace(/^\/src\/pages\//, '');
const rawKeys = fse.readdirSync(path.dirname(this.resourcePath));
const rawKeys = await fs.readdir(path.dirname(this.resourcePath));
const demoKeys = rawKeys.filter((basename) => {
return /\.(js|tsx)$/.test(basename);
});
Expand Down

0 comments on commit 3f9b279

Please sign in to comment.