const pluginFactory = require('./pluginFactory'); const markedOptions = require('../utils/markedOptions'); const path = require('path'); const withMarkdownLoader = pluginFactory((config, _options) => { const loaderPath = path.join(__dirname, '..', 'loaders', 'marked.js'); config.module.rules.push({ test: /\.md$/, use: [ { loader: 'html-loader', options: { esModule: true } }, { loader: path.resolve(loaderPath), options: markedOptions } ] }); }); module.exports = withMarkdownLoader;