From f8353377c4776c2cf4bc7a1a607a8a92bb95867c Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 25 May 2022 00:24:56 +0800 Subject: [PATCH 1/2] Force `@mdx-js/react` dependency and resolution --- loader.js | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/loader.js b/loader.js index c9a80cb..704ff3f 100644 --- a/loader.js +++ b/loader.js @@ -1,10 +1,11 @@ const { getOptions } = require('loader-utils'); const mdx = require('@mdx-js/mdx'); +const mdxReact = require.resolve('@mdx-js/react'); const { createCompiler } = require('./dist/cjs'); const DEFAULT_RENDERER = ` import React from 'react' -import { mdx } from '@mdx-js/react' +import { mdx } from '${mdxReact}' `; // Lifted from MDXv1 loader diff --git a/package.json b/package.json index 017599a..8071c17 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@babel/preset-env": "^7.12.11", "@babel/types": "^7.12.11", "@mdx-js/mdx": "^1.6.22", + "@mdx-js/react": "^1.6.22", "@types/lodash": "^4.14.167", "js-string-escape": "^1.0.1", "loader-utils": "^2.0.0", From 6cee405f738b17e32c1b4635108f1ba1dd450638 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 25 May 2022 00:45:25 +0800 Subject: [PATCH 2/2] Remove resolution hack --- loader.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/loader.js b/loader.js index 704ff3f..c9a80cb 100644 --- a/loader.js +++ b/loader.js @@ -1,11 +1,10 @@ const { getOptions } = require('loader-utils'); const mdx = require('@mdx-js/mdx'); -const mdxReact = require.resolve('@mdx-js/react'); const { createCompiler } = require('./dist/cjs'); const DEFAULT_RENDERER = ` import React from 'react' -import { mdx } from '${mdxReact}' +import { mdx } from '@mdx-js/react' `; // Lifted from MDXv1 loader