aboutsummaryrefslogtreecommitdiff
path: root/plugins/withMarkdownLoader.js
blob: f56af0eb4483f9eb715a94cf579d310842ede6ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;