@mdx-js/loader
Webpack loader for MDX
Last updated 3 years ago by wooorm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @mdx-js/loader 
SYNC missed versions from official npm registry.

@mdx-js/loader

Build Coverage Downloads Sponsors Backers Chat

webpack loader for MDX.

Contents

What is this?

This package is a webpack loader to support MDX.

When should I use this?

This integration is useful if you’re using webpack (or another tool that uses webpack, such as Next.js).

This integration can be combined with the Babel loader to support nonstandard JSX runtimes (such as Vue) or compile modern JavaScript features to ones your users support.

If you want to evaluate MDX code then the lower-level compiler (@mdx-js/mdx) can be used manually.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install @mdx-js/loader@next

yarn:

yarn add @mdx-js/loader@next

Use

Add something along these lines to your webpack.config.js:

module.exports = {
  module: {
    // …
    rules: [
      // …
      {
        test: /\.mdx?$/,
        use: [
          {
            loader: '@mdx-js/loader',
            /** @type {import('@mdx-js/loader').Options} */
            options: {}
          }
        ]
      }
    ]
  }
}

See also ¶ Create React App (CRA), ¶ Next.js, and ¶ Vue CLI, if you’re using webpack through them, for more info.

API

This package exports a webpack plugin as the default export.

Source maps are supported based on how you configure webpack. You do not need to pass options.SourceMapGenerator.

options

options are the same as compile from @mdx-js/mdx.

Note: Babel

If you use modern JavaScript features you might want to use Babel through babel-loader to compile to code that works:

// …
use: [
  // Note that Webpack runs right-to-left: `@mdx-js/loader` is used first, then
  // `babel-loader`.
  {loader: 'babel-loader', options: {}},
  {
    loader: '@mdx-js/loader',
    /** @type {import('@mdx-js/loader').Options} */
    options: {},
  },
];
// …
Note: webpack-cli

webpack-cli doesn’t support loaders in ESM directly or even indirectly. Because @mdx-js/mdx itself is ESM, this means the @mdx-js/loader loader (even though it’s CJS) doesn’t work with webpack-cli (it does work when using the webpack API). To use this loader with webpack-cli, set the DISABLE_V8_COMPILE_CACHE=1 environment variable. See this issue for details.

DISABLE_V8_COMPILE_CACHE=1 webpack

Types

This package is fully typed with TypeScript. See § Types on our website for information.

An Options type is exported, which represents acceptable configuration.

Security

See § Security on our website for information.

Contribute

See § Contribute on our website for ways to get started. See § Support for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Compositor and Vercel

Current Tags

  • 2.0.0-ci.53                                ...           ci (3 years ago)
  • 3.0.1                                ...           latest (9 months ago)
  • 2.0.0-rc.2                                ...           next (3 years ago)

216 Versions

  • 3.0.1                                ...           9 months ago
  • 3.0.0                                ...           a year ago
  • 2.3.0                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.5                                ...           2 years ago
  • 2.1.4                                ...           2 years ago
  • 2.1.3                                ...           2 years ago
  • 2.1.2                                ...           2 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 2.0.0-rc.2                                ...           3 years ago
  • 2.0.0-rc.1                                ...           3 years ago
  • 2.0.0-ci.53                                ...           3 years ago
  • 2.0.0-ci.50                                ...           3 years ago
  • 2.0.0-ci.43                                ...           3 years ago
  • 2.0.0-ci.42                                ...           3 years ago
  • 2.0.0-ci.40                                ...           3 years ago
  • 2.0.0-ci.39                                ...           3 years ago
  • 2.0.0-ci.35                                ...           3 years ago
  • 2.0.0-ci.18                                ...           3 years ago
  • 2.0.0-ci.15                                ...           3 years ago
  • 2.0.0-ci.8                                ...           4 years ago
  • 2.0.0-ci.4                                ...           4 years ago
  • 2.0.0-ci.3                                ...           4 years ago
  • 2.0.0-next.9                                ...           4 years ago
  • 1.6.22                                ...           4 years ago
  • 1.6.21                                ...           4 years ago
  • 1.6.20                                ...           4 years ago
  • 1.6.19                                ...           4 years ago
  • 2.0.0-next.8                                ...           4 years ago
  • 1.6.18                                ...           4 years ago
  • 1.6.17                                ...           4 years ago
  • 2.0.0-next.7                                ...           4 years ago
  • 1.6.16-ci.0                                ...           4 years ago
  • 1.6.16                                ...           4 years ago
  • 1.6.15                                ...           4 years ago
  • 2.0.0-next.6                                ...           4 years ago
  • 1.6.14                                ...           4 years ago
  • 2.0.0-next.4                                ...           4 years ago
  • 1.6.13-ci.1                                ...           4 years ago
  • 1.6.13                                ...           4 years ago
  • 1.6.12-ci.2                                ...           4 years ago
  • 1.6.12                                ...           4 years ago
  • 2.0.0-next.3                                ...           4 years ago
  • 1.6.11                                ...           4 years ago
  • 1.6.11-ci.0                                ...           4 years ago
  • 1.6.10-ci.0                                ...           4 years ago
  • 1.6.10                                ...           4 years ago
  • 1.6.9-ci.0                                ...           4 years ago
  • 1.6.9                                ...           4 years ago
  • 1.6.8                                ...           4 years ago
  • 1.6.8-ci.4                                ...           4 years ago
  • 1.6.7                                ...           4 years ago
  • 1.6.7-ci.4                                ...           4 years ago
  • 1.6.6                                ...           4 years ago
  • 1.6.5                                ...           4 years ago
  • 2.0.0-next.1                                ...           4 years ago
  • 1.6.4                                ...           4 years ago
  • 2.0.0-next.0                                ...           4 years ago
  • 1.6.3                                ...           4 years ago
  • 1.6.2                                ...           4 years ago
  • 1.6.2-ci.1                                ...           5 years ago
  • 1.6.1                                ...           5 years ago
  • 1.6.0                                ...           5 years ago
  • 1.5.9                                ...           5 years ago
  • 1.5.9-ci.5                                ...           5 years ago
  • 1.5.8                                ...           5 years ago
  • 1.5.8-ci.13                                ...           5 years ago
  • 1.5.8-alpha.0                                ...           5 years ago
  • 1.5.7                                ...           5 years ago
  • 1.5.7-alpha.0                                ...           5 years ago
  • 1.5.6                                ...           5 years ago
  • 1.5.6-alpha.0                                ...           5 years ago
  • 1.5.6-ci.0                                ...           5 years ago
  • 1.5.5                                ...           5 years ago
  • 1.5.4                                ...           5 years ago
  • 1.5.3                                ...           5 years ago
  • 1.5.2                                ...           5 years ago
  • 1.5.1                                ...           5 years ago
  • 1.5.0                                ...           5 years ago
  • 1.4.5                                ...           5 years ago
  • 1.4.4                                ...           5 years ago
  • 1.4.3                                ...           5 years ago
  • 1.4.2                                ...           5 years ago
  • 1.4.1                                ...           5 years ago
  • 1.4.0                                ...           5 years ago
  • 1.3.2                                ...           5 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.2                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.1.6                                ...           5 years ago
  • 1.1.5                                ...           5 years ago
  • 1.1.4                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.2-ci.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.1-ci.41                                ...           5 years ago
  • 1.1.1-ci.27                                ...           5 years ago
  • 1.1.1-ci.6                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.27-ci.0                                ...           5 years ago
  • 1.0.27                                ...           5 years ago
  • 1.0.26                                ...           5 years ago
  • 1.0.25                                ...           5 years ago
  • 1.0.24                                ...           5 years ago
  • 1.0.24-ci.5                                ...           5 years ago
  • 1.0.24-ci.3                                ...           5 years ago
  • 1.0.23                                ...           5 years ago
  • 1.0.22                                ...           5 years ago
  • 1.0.21                                ...           5 years ago
  • 1.0.20                                ...           5 years ago
  • 1.0.20-ci.2                                ...           6 years ago
  • 1.0.19-ci.5                                ...           6 years ago
  • 1.0.19                                ...           6 years ago
  • 1.0.18                                ...           6 years ago
  • 1.0.16                                ...           6 years ago
  • 1.0.16-ci.0                                ...           6 years ago
  • 1.0.15                                ...           6 years ago
  • 1.0.14                                ...           6 years ago
  • 1.0.10                                ...           6 years ago
  • 1.0.9                                ...           6 years ago
  • 1.0.8                                ...           6 years ago
  • 1.0.7                                ...           6 years ago
  • 1.0.6                                ...           6 years ago
  • 1.0.5-ci.0                                ...           6 years ago
  • 1.0.5                                ...           6 years ago
  • 1.0.4                                ...           6 years ago
  • 1.0.4-ci.0                                ...           6 years ago
  • 1.0.3-ci.2                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0-ci.0                                ...           6 years ago
  • 1.0.0-rc.4                                ...           6 years ago
  • 1.0.0-rc.3                                ...           6 years ago
  • 1.0.0-rc.2                                ...           6 years ago
  • 1.0.0-rc.0                                ...           6 years ago
  • 1.0.0-alpha.17                                ...           6 years ago
  • 1.0.0-alpha.16                                ...           6 years ago
  • 1.0.0-alpha.15                                ...           6 years ago
  • 1.0.0-alpha.13                                ...           6 years ago
  • 1.0.0-alpha.11                                ...           6 years ago
  • 1.0.0-alpha.10                                ...           6 years ago
  • 1.0.0-alpha.9                                ...           6 years ago
  • 1.0.0-alpha.8                                ...           6 years ago
  • 1.0.0-alpha.7                                ...           6 years ago
  • 1.0.0-alpha.6                                ...           6 years ago
  • 1.0.0-alpha.5                                ...           6 years ago
  • 1.0.0-alpha.1                                ...           6 years ago
  • 0.20.3                                ...           6 years ago
  • 1.0.0-alpha.0                                ...           6 years ago
  • 0.20.2                                ...           6 years ago
  • 0.20.1                                ...           6 years ago
  • 0.20.0                                ...           6 years ago
  • 0.20.0-alpha.0                                ...           6 years ago
  • 0.19.0                                ...           6 years ago
  • 0.19.0-alpha.0                                ...           6 years ago
  • 0.18.2                                ...           6 years ago
  • 0.18.1                                ...           6 years ago
  • 0.18.0                                ...           6 years ago
  • 0.17.5                                ...           6 years ago
  • 0.17.4                                ...           6 years ago
  • 0.17.3                                ...           6 years ago
  • 0.17.0                                ...           6 years ago
  • 0.16.8                                ...           6 years ago
  • 0.16.6                                ...           6 years ago
  • 0.16.5                                ...           6 years ago
  • 0.16.4                                ...           6 years ago
  • 0.16.3                                ...           6 years ago
  • 0.16.2                                ...           6 years ago
  • 0.16.1                                ...           6 years ago
  • 0.16.0                                ...           6 years ago
  • 0.15.7                                ...           6 years ago
  • 0.15.6                                ...           6 years ago
  • 0.15.5                                ...           6 years ago
  • 0.15.4                                ...           6 years ago
  • 0.15.3                                ...           6 years ago
  • 0.15.3-0                                ...           6 years ago
  • 0.15.2                                ...           6 years ago
  • 0.15.1                                ...           6 years ago
  • 0.15.0                                ...           6 years ago
  • 0.15.0-4                                ...           6 years ago
  • 0.15.0-3                                ...           6 years ago
  • 0.15.0-2                                ...           6 years ago
  • 0.15.0-1                                ...           6 years ago
  • 0.15.0-0                                ...           6 years ago
  • 0.14.1                                ...           6 years ago
  • 0.14.0                                ...           6 years ago
  • 0.13.1-1                                ...           6 years ago
  • 0.13.1-0                                ...           6 years ago
  • 0.13.0-0                                ...           6 years ago
  • 0.12.0                                ...           6 years ago
  • 0.11.1                                ...           6 years ago
  • 0.11.1-0                                ...           6 years ago
  • 0.11.0                                ...           6 years ago
  • 0.11.0-0                                ...           6 years ago
  • 0.10.1                                ...           6 years ago
  • 0.10.0                                ...           6 years ago
  • 0.9.0                                ...           7 years ago
  • 0.8.1                                ...           7 years ago
  • 0.8.1-0                                ...           7 years ago
  • 0.8.0                                ...           7 years ago
  • 0.7.4                                ...           7 years ago
  • 0.7.3                                ...           7 years ago
  • 0.7.2                                ...           7 years ago
  • 0.7.0                                ...           7 years ago
  • 0.7.0-2                                ...           7 years ago
  • 0.7.0-1                                ...           7 years ago
  • 0.7.0-0                                ...           7 years ago
  • 0.6.0                                ...           7 years ago
  • 0.5.0                                ...           7 years ago
  • 0.4.1                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
Downloads
Total 7
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (12)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE