1.0.0 • Published 2 years ago

webpack-markdown-loader-self v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Markdown Loader

A markdown loader for webpack using markdown-it.

Installation

npm install webpack-markdown-loader-self

Usage

//webpack.config.js
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');


module.exports = {
    entry: './src/js/index.js',

    output: {
        filename: 'index.js',
        path: path.resolve(__dirname, 'dist'),
        clean: true
    },

    resolveLoader: {
        modules: ['node_modules', path.resolve(__dirname, 'loaders')],
    },
    module: {
        rules: [

            {
                test: /\.md$/,
                use: [{
                        loader: 'html-loader',
                        options: {
                            esModule: false,
                        }
                    },
                    {
                        loader: 'webpack-markdown-loader-self',
                        options: {
                            html: true,
                        }
                    },
                ]
            }

        ],
    },

    plugins: [
        new HtmlWebpackPlugin({
            filename: 'index.html',
            template: './src/views/index.html',
        }),
    ],
}