@hewes/storybook-addon-docs-graymatter
Version:
Storybook graymatter docs plugin
29 lines (28 loc) • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
webpackFinal: async (webpackConfig, options) => {
var _a, _b, _c;
webpackConfig.module = webpackConfig.module || { rules: [] };
const mdxRules = (_b = (_a = webpackConfig.module) === null || _a === void 0 ? void 0 : _a.rules.find((r) => { var _a; return ((_a = r.test) === null || _a === void 0 ? void 0 : _a.toString()) === "/(\\.)?(stories|story)\\.mdx$/"; })) !== null && _b !== void 0 ? _b : {
use: [],
};
webpackConfig.module.rules = [
{
test: /\.md$/,
// @ts-ignore
use: [...((_c = mdxRules.use) !== null && _c !== void 0 ? _c : [])].concat([
{
loader: require.resolve("./loaders/graymatter.js"),
options: {
prefix: options === null || options === void 0 ? void 0 : options.prefix,
fileNameFallback: options === null || options === void 0 ? void 0 : options.fileNameFallback,
},
},
]),
enforce: "pre",
},
].concat(webpackConfig.module.rules.filter((r) => { var _a; return ((_a = r.test) === null || _a === void 0 ? void 0 : _a.toString()) !== "/\\.md$/"; }));
return webpackConfig;
},
};