🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ware-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ware-loader

A loader for webpack that let you change your source in loader.

latest
Source
npmnpm
Version
0.2.4
Version published
Maintainers
1
Created
Source

npm deps

Ware Loader

A loader for webpack that let you change your source in loader.

Install

npm install --save-dev ware-loader

Examples

Use the loader either via your webpack config. Here is an example to parse markdown file as vue component.

webpack.config.js

const MarkdownIt = require('markdonw-it')
const md = new MarkdownIt()

module.exports = {
  module: {
    rules: [
      {
        test: /\.md$/,
        loader: 'ware-loader',
        enforce: 'pre',
        options: {
          raw: true,
          middleware: function(source) {
            return `<template><div>${md.render(source)}</div></template>`
          }
        }
      },
      {
        test: /\.md$/,
        use: 'vue-loader'
      }
    ]
  }
}

In your application

import Doc from './doc.md';

Options

OptionDescriptionTypeDefault
rawIf set to false, source will be wrapped with 'module.exports = ' + sourcebooleanfalse
asyncWhehter middleware should be async functionbooleanfalse
middlewareFunctions to change sourcefunction[], function-

Maintainers


Cyril Su

Keywords

webpack

FAQs

Package last updated on 05 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts